import pandas as pd
import numpy as np
from itertools import product
from collections import defaultdict
# Stationarity tests
from statsmodels.tsa.stattools import adfuller, kpss
# Autocorr test
from statsmodels.stats.diagnostic import acorr_ljungbox
# Autocorrelation analysis
from statsmodels.tsa.stattools import acf, pacf
from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
#Metric evaluation
from utilsforecast.losses import rmse, mape, mae
from utilsforecast.evaluation import evaluate
# Visualizations
import matplotlib.pyplot as plt
import plotly.express as px
import seaborn as sns
from scipy.stats import norm
import scipy.stats as stats
#Ridge regression
!pip install mlforecast==1.0.1
from mlforecast import MLForecast
from mlforecast.lag_transforms import ExpandingMean, RollingMean
from mlforecast.target_transforms import Differences
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import Ridge
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
Requirement already satisfied: mlforecast==1.0.1 in d:\programs\anaconda3\lib\site-packages (1.0.1) Requirement already satisfied: cloudpickle in d:\programs\anaconda3\lib\site-packages (from mlforecast==1.0.1) (2.2.1) Requirement already satisfied: coreforecast>=0.0.15 in d:\programs\anaconda3\lib\site-packages (from mlforecast==1.0.1) (0.0.15) Requirement already satisfied: fsspec in d:\programs\anaconda3\lib\site-packages (from mlforecast==1.0.1) (2024.12.0) Requirement already satisfied: optuna in d:\programs\anaconda3\lib\site-packages (from mlforecast==1.0.1) (4.2.0) Requirement already satisfied: pandas in d:\programs\anaconda3\lib\site-packages (from mlforecast==1.0.1) (1.5.3) Requirement already satisfied: scikit-learn in d:\programs\anaconda3\lib\site-packages (from mlforecast==1.0.1) (1.3.0) Requirement already satisfied: utilsforecast>=0.2.9 in d:\programs\anaconda3\lib\site-packages (from mlforecast==1.0.1) (0.2.10) Requirement already satisfied: numpy>=1.20.0 in d:\programs\anaconda3\lib\site-packages (from coreforecast>=0.0.15->mlforecast==1.0.1) (1.24.3) Requirement already satisfied: packaging in d:\programs\anaconda3\lib\site-packages (from utilsforecast>=0.2.9->mlforecast==1.0.1) (23.0) Requirement already satisfied: python-dateutil>=2.8.1 in d:\programs\anaconda3\lib\site-packages (from pandas->mlforecast==1.0.1) (2.8.2) Requirement already satisfied: pytz>=2020.1 in d:\programs\anaconda3\lib\site-packages (from pandas->mlforecast==1.0.1) (2022.7) Requirement already satisfied: alembic>=1.5.0 in d:\programs\anaconda3\lib\site-packages (from optuna->mlforecast==1.0.1) (1.14.1) Requirement already satisfied: colorlog in d:\programs\anaconda3\lib\site-packages (from optuna->mlforecast==1.0.1) (6.9.0) Requirement already satisfied: sqlalchemy>=1.4.2 in d:\programs\anaconda3\lib\site-packages (from optuna->mlforecast==1.0.1) (1.4.39) Requirement already satisfied: tqdm in d:\programs\anaconda3\lib\site-packages (from optuna->mlforecast==1.0.1) (4.67.1) Requirement already satisfied: PyYAML in d:\programs\anaconda3\lib\site-packages (from optuna->mlforecast==1.0.1) (6.0) Requirement already satisfied: scipy>=1.5.0 in d:\programs\anaconda3\lib\site-packages (from scikit-learn->mlforecast==1.0.1) (1.10.1) Requirement already satisfied: joblib>=1.1.1 in d:\programs\anaconda3\lib\site-packages (from scikit-learn->mlforecast==1.0.1) (1.2.0) Requirement already satisfied: threadpoolctl>=2.0.0 in d:\programs\anaconda3\lib\site-packages (from scikit-learn->mlforecast==1.0.1) (3.5.0) Requirement already satisfied: Mako in d:\programs\anaconda3\lib\site-packages (from alembic>=1.5.0->optuna->mlforecast==1.0.1) (1.3.8) Requirement already satisfied: typing-extensions>=4 in d:\programs\anaconda3\lib\site-packages (from alembic>=1.5.0->optuna->mlforecast==1.0.1) (4.11.0) Requirement already satisfied: six>=1.5 in d:\programs\anaconda3\lib\site-packages (from python-dateutil>=2.8.1->pandas->mlforecast==1.0.1) (1.16.0) Requirement already satisfied: greenlet!=0.4.17 in d:\programs\anaconda3\lib\site-packages (from sqlalchemy>=1.4.2->optuna->mlforecast==1.0.1) (2.0.1) Requirement already satisfied: colorama in d:\programs\anaconda3\lib\site-packages (from colorlog->optuna->mlforecast==1.0.1) (0.4.6) Requirement already satisfied: MarkupSafe>=0.9.2 in d:\programs\anaconda3\lib\site-packages (from Mako->alembic>=1.5.0->optuna->mlforecast==1.0.1) (2.1.1)
#XGboost
!pip install xgboost==2.1.3
import xgboost as xgb
Requirement already satisfied: xgboost==2.1.3 in d:\programs\anaconda3\lib\site-packages (2.1.3) Requirement already satisfied: numpy in d:\programs\anaconda3\lib\site-packages (from xgboost==2.1.3) (1.24.3) Requirement already satisfied: scipy in d:\programs\anaconda3\lib\site-packages (from xgboost==2.1.3) (1.10.1)
#ARIMA
!pip install statsforecast==2.0.0
from statsforecast import StatsForecast
from statsforecast.models import AutoARIMA
from statsforecast.arima import arima_string
Requirement already satisfied: statsforecast==2.0.0 in d:\programs\anaconda3\lib\site-packages (2.0.0) Requirement already satisfied: cloudpickle in d:\programs\anaconda3\lib\site-packages (from statsforecast==2.0.0) (2.2.1) Requirement already satisfied: coreforecast>=0.0.12 in d:\programs\anaconda3\lib\site-packages (from statsforecast==2.0.0) (0.0.15) Requirement already satisfied: numba>=0.55.0 in d:\programs\anaconda3\lib\site-packages (from statsforecast==2.0.0) (0.57.0) Requirement already satisfied: numpy>=1.21.6 in d:\programs\anaconda3\lib\site-packages (from statsforecast==2.0.0) (1.24.3) Requirement already satisfied: pandas>=1.3.5 in d:\programs\anaconda3\lib\site-packages (from statsforecast==2.0.0) (1.5.3) Requirement already satisfied: scipy>=1.7.3 in d:\programs\anaconda3\lib\site-packages (from statsforecast==2.0.0) (1.10.1) Requirement already satisfied: statsmodels>=0.13.2 in d:\programs\anaconda3\lib\site-packages (from statsforecast==2.0.0) (0.14.0) Requirement already satisfied: tqdm in d:\programs\anaconda3\lib\site-packages (from statsforecast==2.0.0) (4.67.1) Requirement already satisfied: fugue>=0.8.1 in d:\programs\anaconda3\lib\site-packages (from statsforecast==2.0.0) (0.9.1) Requirement already satisfied: utilsforecast>=0.1.4 in d:\programs\anaconda3\lib\site-packages (from statsforecast==2.0.0) (0.2.10) Requirement already satisfied: threadpoolctl>=3 in d:\programs\anaconda3\lib\site-packages (from statsforecast==2.0.0) (3.5.0) Requirement already satisfied: triad>=0.9.7 in d:\programs\anaconda3\lib\site-packages (from fugue>=0.8.1->statsforecast==2.0.0) (0.9.8) Requirement already satisfied: adagio>=0.2.4 in d:\programs\anaconda3\lib\site-packages (from fugue>=0.8.1->statsforecast==2.0.0) (0.2.6) Requirement already satisfied: llvmlite<0.41,>=0.40.0dev0 in d:\programs\anaconda3\lib\site-packages (from numba>=0.55.0->statsforecast==2.0.0) (0.40.0) Requirement already satisfied: python-dateutil>=2.8.1 in d:\programs\anaconda3\lib\site-packages (from pandas>=1.3.5->statsforecast==2.0.0) (2.8.2) Requirement already satisfied: pytz>=2020.1 in d:\programs\anaconda3\lib\site-packages (from pandas>=1.3.5->statsforecast==2.0.0) (2022.7) Requirement already satisfied: patsy>=0.5.2 in d:\programs\anaconda3\lib\site-packages (from statsmodels>=0.13.2->statsforecast==2.0.0) (0.5.3) Requirement already satisfied: packaging>=21.3 in d:\programs\anaconda3\lib\site-packages (from statsmodels>=0.13.2->statsforecast==2.0.0) (23.0) Requirement already satisfied: colorama in d:\programs\anaconda3\lib\site-packages (from tqdm->statsforecast==2.0.0) (0.4.6) Requirement already satisfied: six in d:\programs\anaconda3\lib\site-packages (from patsy>=0.5.2->statsmodels>=0.13.2->statsforecast==2.0.0) (1.16.0) Requirement already satisfied: pyarrow>=6.0.1 in d:\programs\anaconda3\lib\site-packages (from triad>=0.9.7->fugue>=0.8.1->statsforecast==2.0.0) (19.0.1) Requirement already satisfied: fsspec>=2022.5.0 in d:\programs\anaconda3\lib\site-packages (from triad>=0.9.7->fugue>=0.8.1->statsforecast==2.0.0) (2024.12.0) Requirement already satisfied: fs in d:\programs\anaconda3\lib\site-packages (from triad>=0.9.7->fugue>=0.8.1->statsforecast==2.0.0) (2.4.16) Requirement already satisfied: appdirs~=1.4.3 in d:\programs\anaconda3\lib\site-packages (from fs->triad>=0.9.7->fugue>=0.8.1->statsforecast==2.0.0) (1.4.4) Requirement already satisfied: setuptools in d:\programs\anaconda3\lib\site-packages (from fs->triad>=0.9.7->fugue>=0.8.1->statsforecast==2.0.0) (68.0.0)
#LSTM
!pip install neuralforecast==2.0.1
import logging
from neuralforecast import NeuralForecast
from neuralforecast.models import LSTM, NHITS, RNN
logging.getLogger('pytorch_lightning').setLevel(logging.ERROR)
Requirement already satisfied: neuralforecast==2.0.1 in d:\programs\anaconda3\lib\site-packages (2.0.1) Requirement already satisfied: coreforecast>=0.0.6 in d:\programs\anaconda3\lib\site-packages (from neuralforecast==2.0.1) (0.0.15) Requirement already satisfied: fsspec in d:\programs\anaconda3\lib\site-packages (from neuralforecast==2.0.1) (2024.12.0) Requirement already satisfied: numpy>=1.21.6 in d:\programs\anaconda3\lib\site-packages (from neuralforecast==2.0.1) (1.24.3) Requirement already satisfied: pandas>=1.3.5 in d:\programs\anaconda3\lib\site-packages (from neuralforecast==2.0.1) (1.5.3) Requirement already satisfied: torch>=2.0.0 in d:\programs\anaconda3\lib\site-packages (from neuralforecast==2.0.1) (2.6.0) Requirement already satisfied: pytorch-lightning>=2.0.0 in d:\programs\anaconda3\lib\site-packages (from neuralforecast==2.0.1) (2.5.0.post0) Requirement already satisfied: ray[tune]>=2.2.0 in d:\programs\anaconda3\lib\site-packages (from neuralforecast==2.0.1) (2.41.0) Requirement already satisfied: optuna in d:\programs\anaconda3\lib\site-packages (from neuralforecast==2.0.1) (4.2.0) Requirement already satisfied: utilsforecast>=0.2.3 in d:\programs\anaconda3\lib\site-packages (from neuralforecast==2.0.1) (0.2.10) Requirement already satisfied: python-dateutil>=2.8.1 in d:\programs\anaconda3\lib\site-packages (from pandas>=1.3.5->neuralforecast==2.0.1) (2.8.2) Requirement already satisfied: pytz>=2020.1 in d:\programs\anaconda3\lib\site-packages (from pandas>=1.3.5->neuralforecast==2.0.1) (2022.7) Requirement already satisfied: tqdm>=4.57.0 in d:\programs\anaconda3\lib\site-packages (from pytorch-lightning>=2.0.0->neuralforecast==2.0.1) (4.67.1) Requirement already satisfied: PyYAML>=5.4 in d:\programs\anaconda3\lib\site-packages (from pytorch-lightning>=2.0.0->neuralforecast==2.0.1) (6.0) Requirement already satisfied: torchmetrics>=0.7.0 in d:\programs\anaconda3\lib\site-packages (from pytorch-lightning>=2.0.0->neuralforecast==2.0.1) (1.6.1) Requirement already satisfied: packaging>=20.0 in d:\programs\anaconda3\lib\site-packages (from pytorch-lightning>=2.0.0->neuralforecast==2.0.1) (23.0) Requirement already satisfied: typing-extensions>=4.4.0 in d:\programs\anaconda3\lib\site-packages (from pytorch-lightning>=2.0.0->neuralforecast==2.0.1) (4.11.0) Requirement already satisfied: lightning-utilities>=0.10.0 in d:\programs\anaconda3\lib\site-packages (from pytorch-lightning>=2.0.0->neuralforecast==2.0.1) (0.12.0) Requirement already satisfied: click>=7.0 in d:\programs\anaconda3\lib\site-packages (from ray[tune]>=2.2.0->neuralforecast==2.0.1) (8.0.4) Requirement already satisfied: filelock in d:\programs\anaconda3\lib\site-packages (from ray[tune]>=2.2.0->neuralforecast==2.0.1) (3.9.0) Requirement already satisfied: jsonschema in d:\programs\anaconda3\lib\site-packages (from ray[tune]>=2.2.0->neuralforecast==2.0.1) (4.17.3) Requirement already satisfied: msgpack<2.0.0,>=1.0.0 in d:\programs\anaconda3\lib\site-packages (from ray[tune]>=2.2.0->neuralforecast==2.0.1) (1.0.3) Requirement already satisfied: protobuf!=3.19.5,>=3.15.3 in d:\programs\anaconda3\lib\site-packages (from ray[tune]>=2.2.0->neuralforecast==2.0.1) (5.29.3) Requirement already satisfied: aiosignal in d:\programs\anaconda3\lib\site-packages (from ray[tune]>=2.2.0->neuralforecast==2.0.1) (1.2.0) Requirement already satisfied: frozenlist in d:\programs\anaconda3\lib\site-packages (from ray[tune]>=2.2.0->neuralforecast==2.0.1) (1.3.3) Requirement already satisfied: requests in d:\programs\anaconda3\lib\site-packages (from ray[tune]>=2.2.0->neuralforecast==2.0.1) (2.32.3) Requirement already satisfied: tensorboardX>=1.9 in d:\programs\anaconda3\lib\site-packages (from ray[tune]>=2.2.0->neuralforecast==2.0.1) (2.6.2.2) Requirement already satisfied: pyarrow>=9.0.0 in d:\programs\anaconda3\lib\site-packages (from ray[tune]>=2.2.0->neuralforecast==2.0.1) (19.0.1) Requirement already satisfied: networkx in d:\programs\anaconda3\lib\site-packages (from torch>=2.0.0->neuralforecast==2.0.1) (3.1) Requirement already satisfied: jinja2 in d:\programs\anaconda3\lib\site-packages (from torch>=2.0.0->neuralforecast==2.0.1) (3.1.2) Requirement already satisfied: sympy==1.13.1 in d:\programs\anaconda3\lib\site-packages (from torch>=2.0.0->neuralforecast==2.0.1) (1.13.1) Requirement already satisfied: mpmath<1.4,>=1.1.0 in d:\programs\anaconda3\lib\site-packages (from sympy==1.13.1->torch>=2.0.0->neuralforecast==2.0.1) (1.3.0) Requirement already satisfied: alembic>=1.5.0 in d:\programs\anaconda3\lib\site-packages (from optuna->neuralforecast==2.0.1) (1.14.1) Requirement already satisfied: colorlog in d:\programs\anaconda3\lib\site-packages (from optuna->neuralforecast==2.0.1) (6.9.0) Requirement already satisfied: sqlalchemy>=1.4.2 in d:\programs\anaconda3\lib\site-packages (from optuna->neuralforecast==2.0.1) (1.4.39) Requirement already satisfied: Mako in d:\programs\anaconda3\lib\site-packages (from alembic>=1.5.0->optuna->neuralforecast==2.0.1) (1.3.8) Requirement already satisfied: colorama in d:\programs\anaconda3\lib\site-packages (from click>=7.0->ray[tune]>=2.2.0->neuralforecast==2.0.1) (0.4.6) Requirement already satisfied: aiohttp!=4.0.0a0,!=4.0.0a1 in d:\programs\anaconda3\lib\site-packages (from fsspec->neuralforecast==2.0.1) (3.8.3) Requirement already satisfied: setuptools in d:\programs\anaconda3\lib\site-packages (from lightning-utilities>=0.10.0->pytorch-lightning>=2.0.0->neuralforecast==2.0.1) (68.0.0) Requirement already satisfied: six>=1.5 in d:\programs\anaconda3\lib\site-packages (from python-dateutil>=2.8.1->pandas>=1.3.5->neuralforecast==2.0.1) (1.16.0) Requirement already satisfied: greenlet!=0.4.17 in d:\programs\anaconda3\lib\site-packages (from sqlalchemy>=1.4.2->optuna->neuralforecast==2.0.1) (2.0.1) Requirement already satisfied: MarkupSafe>=2.0 in d:\programs\anaconda3\lib\site-packages (from jinja2->torch>=2.0.0->neuralforecast==2.0.1) (2.1.1) Requirement already satisfied: attrs>=17.4.0 in d:\programs\anaconda3\lib\site-packages (from jsonschema->ray[tune]>=2.2.0->neuralforecast==2.0.1) (23.2.0) Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in d:\programs\anaconda3\lib\site-packages (from jsonschema->ray[tune]>=2.2.0->neuralforecast==2.0.1) (0.18.0) Requirement already satisfied: charset-normalizer<4,>=2 in d:\programs\anaconda3\lib\site-packages (from requests->ray[tune]>=2.2.0->neuralforecast==2.0.1) (2.0.4) Requirement already satisfied: idna<4,>=2.5 in d:\programs\anaconda3\lib\site-packages (from requests->ray[tune]>=2.2.0->neuralforecast==2.0.1) (3.4) Requirement already satisfied: urllib3<3,>=1.21.1 in d:\programs\anaconda3\lib\site-packages (from requests->ray[tune]>=2.2.0->neuralforecast==2.0.1) (1.26.16) Requirement already satisfied: certifi>=2017.4.17 in d:\programs\anaconda3\lib\site-packages (from requests->ray[tune]>=2.2.0->neuralforecast==2.0.1) (2023.7.22) Requirement already satisfied: multidict<7.0,>=4.5 in d:\programs\anaconda3\lib\site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec->neuralforecast==2.0.1) (6.0.2) Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in d:\programs\anaconda3\lib\site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec->neuralforecast==2.0.1) (4.0.2) Requirement already satisfied: yarl<2.0,>=1.0 in d:\programs\anaconda3\lib\site-packages (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec->neuralforecast==2.0.1) (1.8.1)
#Prophet
!pip install prophet==1.1.6
import prophet as fp
from prophet.diagnostics import performance_metrics, cross_validation
Requirement already satisfied: prophet==1.1.6 in d:\programs\anaconda3\lib\site-packages (1.1.6) Requirement already satisfied: cmdstanpy>=1.0.4 in d:\programs\anaconda3\lib\site-packages (from prophet==1.1.6) (1.2.5) Requirement already satisfied: numpy>=1.15.4 in d:\programs\anaconda3\lib\site-packages (from prophet==1.1.6) (1.24.3) Requirement already satisfied: matplotlib>=2.0.0 in d:\programs\anaconda3\lib\site-packages (from prophet==1.1.6) (3.7.1) Requirement already satisfied: pandas>=1.0.4 in d:\programs\anaconda3\lib\site-packages (from prophet==1.1.6) (1.5.3) Requirement already satisfied: holidays<1,>=0.25 in d:\programs\anaconda3\lib\site-packages (from prophet==1.1.6) (0.62) Requirement already satisfied: tqdm>=4.36.1 in d:\programs\anaconda3\lib\site-packages (from prophet==1.1.6) (4.67.1) Requirement already satisfied: importlib-resources in d:\programs\anaconda3\lib\site-packages (from prophet==1.1.6) (6.4.5) Requirement already satisfied: stanio<2.0.0,>=0.4.0 in d:\programs\anaconda3\lib\site-packages (from cmdstanpy>=1.0.4->prophet==1.1.6) (0.5.1) Requirement already satisfied: python-dateutil in d:\programs\anaconda3\lib\site-packages (from holidays<1,>=0.25->prophet==1.1.6) (2.8.2) Requirement already satisfied: contourpy>=1.0.1 in d:\programs\anaconda3\lib\site-packages (from matplotlib>=2.0.0->prophet==1.1.6) (1.0.5) Requirement already satisfied: cycler>=0.10 in d:\programs\anaconda3\lib\site-packages (from matplotlib>=2.0.0->prophet==1.1.6) (0.11.0) Requirement already satisfied: fonttools>=4.22.0 in d:\programs\anaconda3\lib\site-packages (from matplotlib>=2.0.0->prophet==1.1.6) (4.25.0) Requirement already satisfied: kiwisolver>=1.0.1 in d:\programs\anaconda3\lib\site-packages (from matplotlib>=2.0.0->prophet==1.1.6) (1.4.4) Requirement already satisfied: packaging>=20.0 in d:\programs\anaconda3\lib\site-packages (from matplotlib>=2.0.0->prophet==1.1.6) (23.0) Requirement already satisfied: pillow>=6.2.0 in d:\programs\anaconda3\lib\site-packages (from matplotlib>=2.0.0->prophet==1.1.6) (9.4.0) Requirement already satisfied: pyparsing>=2.3.1 in d:\programs\anaconda3\lib\site-packages (from matplotlib>=2.0.0->prophet==1.1.6) (3.0.9) Requirement already satisfied: pytz>=2020.1 in d:\programs\anaconda3\lib\site-packages (from pandas>=1.0.4->prophet==1.1.6) (2022.7) Requirement already satisfied: colorama in d:\programs\anaconda3\lib\site-packages (from tqdm>=4.36.1->prophet==1.1.6) (0.4.6) Requirement already satisfied: six>=1.5 in d:\programs\anaconda3\lib\site-packages (from python-dateutil->holidays<1,>=0.25->prophet==1.1.6) (1.16.0)
import warnings
warnings.filterwarnings('ignore')
#Create new file with logs every run for model versioning and model metrics logging
import logging, datetime, sys
dateTag = datetime.datetime.now().strftime("%d-%b-%Y_%H-%M-%S")
model_metrics_logger = logging.getLogger('model_metrics')
model_metrics_logger.handlers.clear()
model_metrics_logger.addHandler(logging.FileHandler("model_metrics_%s.log" % dateTag))
model_metrics_logger.addHandler(logging.StreamHandler(sys.stdout))
model_metrics_logger.setLevel(level=logging.INFO)
random_state = 42
def evaluate_cross_validation(df, metrics):
"""
Calculate metric score for cross-validation
"""
models = df.drop(columns=['unique_id', 'ds', 'cutoff', 'y']).columns.tolist()
evals = []
# Calculate loss for every unique_id and cutoff.
for cutoff in df['cutoff'].unique():
eval_ = evaluate(df[df['cutoff'] == cutoff], metrics=metrics, models=models)
evals.append(eval_)
evals = pd.concat(evals)
evals = evals.groupby(['unique_id', 'metric']).mean(numeric_only=True) # Averages the error metrics for all cutoffs for every combination of model and unique_id
return evals
class GridSearch:
"""
Class for making grid search of hyperparameters for models by using cross-validation.
"""
def __init__(self, all_params, model_initializer, calculate_score):
self.all_params = all_params
self.calculate_score = calculate_score
self.initialize_model = model_initializer
self.results_df = None
self.best_params = None
self.best_score = None
def search(self):
""" Evaluate vie cross-validation score for each set of hyperparameters from grid and write them to result DataFrame.
"""
params_product = self.__params_product()
results_dict = dict()
for item in enumerate(params_product):
index = item[0]
params = item[1]
model = self.initialize_model(params)
current_score = self.calculate_score(model)
if self.best_score is None or current_score < self.best_score:
self.best_score = current_score
self.best_params = params
print(f'Iteration: {index + 1} of {len(params_product)}\n\tParams: {params}\n\tScore: {current_score}')
results_dict.setdefault('score', []).append(current_score)
self.__add_to_results(results_dict, params)
print(f'Best score: {self.best_score} \n\twith params {self.best_params}')
self.results_df = pd.DataFrame(results_dict).sort_values(by='score')
def display_results(self):
""" Display result table with hyperparameters sorted by score.
"""
display(self.results_df)
def get_best_params(self):
""" Return hyperparameters which showed higher score on cross-validation.
"""
return self.best_params
def __add_to_results(self, results, params):
for k, v in params.items():
result_params = results.setdefault(k, [])
result_params.append(v)
def __params_product(self):
return [dict(zip(self.all_params.keys(), vcomb)) for vcomb in product(*self.all_params.values())]
def my_mape(predictions, targets):
""" Calculate MAPE score.
"""
return np.mean(np.abs((predictions - targets) / predictions)) * 100
def adf_test(timeseries):
""" Calculate ADF test statistic.
"""
print("Results of Dickey-Fuller Test:")
dftest = adfuller(timeseries, autolag="AIC")
dfoutput = pd.Series(
dftest[0:4],
index=[
"Test Statistic",
"p-value",
"#Lags Used",
"Number of Observations Used",
],
)
for key, value in dftest[4].items():
dfoutput["Critical Value (%s)" % key] = value
print(dfoutput)
def plot_residuals(residuals):
""" Plot for residuals analyzing:
1. Residuals Plot.
2. Histogram plus estimated density.
3. Normal Q-Q Plot.
4. Correlogram.
"""
fig, axs = plt.subplots(nrows=2, ncols=2, figsize=(12, 10))
# plot[1,1]
residuals.plot(ax=axs[0,0])
axs[0,0].set_title("Residuals")
# plot
sns.distplot(residuals, ax=axs[0,1], fit=norm) # add fit=norm to visualize norm distribution
axs[0,1].set_title("Density plot - Residual")
# plot
stats.probplot(residuals, dist="norm", plot=axs[1,0])
axs[1,0].set_title('Plot Q-Q')
# plot
plot_acf(residuals, lags=35, ax=axs[1,1],color="fuchsia")
axs[1,1].set_title("Autocorrelation")
plt.show()
We'll be analyzing closing stocks prices. Get data from here.
nvidia_stocks_full = pd.read_csv('NVDA_230122_250122.csv')
nvidia_stocks_full.head()
| <TICKER> | <PER> | <DATE> | <TIME> | <OPEN> | <HIGH> | <LOW> | <CLOSE> | <VOL> | |
|---|---|---|---|---|---|---|---|---|---|
| 0 | NVDA | D | 23/01/23 | 00:00:00 | 18.0690 | 19.245 | 17.819 | 19.192 | 15035650 |
| 1 | NVDA | D | 24/01/23 | 00:00:00 | 18.8370 | 19.484 | 18.825 | 19.265 | 9503480 |
| 2 | NVDA | D | 25/01/23 | 00:00:00 | 18.9125 | 19.365 | 18.581 | 19.332 | 8723800 |
| 3 | NVDA | D | 26/01/23 | 00:00:00 | 19.7240 | 20.162 | 19.278 | 19.799 | 8941270 |
| 4 | NVDA | D | 27/01/23 | 00:00:00 | 19.4620 | 20.627 | 19.424 | 20.356 | 10233070 |
Here's some simple preprocessing.
nvidia_stocks_full.index=pd.to_datetime(nvidia_stocks_full['<DATE>']+nvidia_stocks_full['<TIME>'],format="%d/%m/%y%H:%M:%S")
nvidia_stocks_full.index.names = ['ds']
nvidia_stocks_full.head()
| <TICKER> | <PER> | <DATE> | <TIME> | <OPEN> | <HIGH> | <LOW> | <CLOSE> | <VOL> | |
|---|---|---|---|---|---|---|---|---|---|
| ds | |||||||||
| 2023-01-23 | NVDA | D | 23/01/23 | 00:00:00 | 18.0690 | 19.245 | 17.819 | 19.192 | 15035650 |
| 2023-01-24 | NVDA | D | 24/01/23 | 00:00:00 | 18.8370 | 19.484 | 18.825 | 19.265 | 9503480 |
| 2023-01-25 | NVDA | D | 25/01/23 | 00:00:00 | 18.9125 | 19.365 | 18.581 | 19.332 | 8723800 |
| 2023-01-26 | NVDA | D | 26/01/23 | 00:00:00 | 19.7240 | 20.162 | 19.278 | 19.799 | 8941270 |
| 2023-01-27 | NVDA | D | 27/01/23 | 00:00:00 | 19.4620 | 20.627 | 19.424 | 20.356 | 10233070 |
nvidia_stocks = nvidia_stocks_full.copy()
nvidia_stocks.rename(columns={'<CLOSE>':'y'}, inplace=True)
nvidia_stocks = nvidia_stocks[['y']]
nvidia_stocks = nvidia_stocks.resample('D').mean().interpolate()
nvidia_stocks['unique_id'] = 'stock_id'
nvidia_stocks.reset_index(inplace=True)
nvidia_stocks
| ds | y | unique_id | |
|---|---|---|---|
| 0 | 2023-01-23 | 19.1920 | stock_id |
| 1 | 2023-01-24 | 19.2650 | stock_id |
| 2 | 2023-01-25 | 19.3320 | stock_id |
| 3 | 2023-01-26 | 19.7990 | stock_id |
| 4 | 2023-01-27 | 20.3560 | stock_id |
| ... | ... | ... | ... |
| 725 | 2025-01-17 | 137.7400 | stock_id |
| 726 | 2025-01-18 | 138.5125 | stock_id |
| 727 | 2025-01-19 | 139.2850 | stock_id |
| 728 | 2025-01-20 | 140.0575 | stock_id |
| 729 | 2025-01-21 | 140.8300 | stock_id |
730 rows × 3 columns
Let's plot our data.
fig = px.line(nvidia_stocks, x=nvidia_stocks['ds'], y=nvidia_stocks['y'],
title="Nvidia closing prices (1 day)")
fig.update_layout(template='plotly_white', width=800, height=500)
fig.update_xaxes(title_text="date")
fig.update_yaxes(title_text="closing price")
fig.show()
Split your time series into train/test in proportion 80/20.
train_size = int(len(nvidia_stocks) * 0.8)
train, test = nvidia_stocks[:train_size], nvidia_stocks[train_size:]
Let's plot test and train Nvidia closing stock prices
fig = px.line(title="Nvidia closing prices (1 day)")
fig.add_scatter(x=train['ds'], y=train['y'], mode='lines', name='train', line=dict(color='blue'))
fig.add_scatter(x=test['ds'], y=test['y'], mode='lines', name='test', line=dict(color='green'))
fig.update_layout(template='plotly_white', width=1000, height=500)
fig.update_xaxes(title_text="date")
fig.update_yaxes(title_text="closing price")
fig.show()
Perform ADF test to check for stationarity
adf_test(train['y'])
Results of Dickey-Fuller Test: Test Statistic 0.026515 p-value 0.960671 #Lags Used 19.000000 Number of Observations Used 564.000000 Critical Value (1%) -3.441998 Critical Value (5%) -2.866678 Critical Value (10%) -2.569506 dtype: float64
**p-value > significance level (default: 0.05)** => we do NOT reject H(0) and our ts is not stationary (ADF).
Differencing is a common technique used to make a time series stationary by removing trends or seasonality. It is especially useful when the data shows patterns that change over time, such as increasing or decreasing trends.
Formula (1st order)
$ΔY_t = Y_t - Y_{t-1}$ or $y'_t = y_t - y_{t-1}$
train_diff = train.copy()
train_diff['diff'] = train_diff['y'].diff()
train_diff.head()
| ds | y | unique_id | diff | |
|---|---|---|---|---|
| 0 | 2023-01-23 | 19.192 | stock_id | NaN |
| 1 | 2023-01-24 | 19.265 | stock_id | 0.073 |
| 2 | 2023-01-25 | 19.332 | stock_id | 0.067 |
| 3 | 2023-01-26 | 19.799 | stock_id | 0.467 |
| 4 | 2023-01-27 | 20.356 | stock_id | 0.557 |
Let's see if differencing of the 1st order made the time series stationary.
fig = px.line(train_diff, x=train_diff.index, y=train_diff['diff'],
title="Nvidia closing prices (daily) - diff(1))")
fig.update_layout(template='plotly_white', width=800, height=500)
fig.update_xaxes(title_text="date")
fig.update_yaxes(title_text="closing price")
fig.show()
Differenced time series looks stationary. But let's test it using ADF test.
adf_test(train_diff['diff'].dropna())
Results of Dickey-Fuller Test: Test Statistic -5.169163 p-value 0.000010 #Lags Used 18.000000 Number of Observations Used 564.000000 Critical Value (1%) -3.441998 Critical Value (5%) -2.866678 Critical Value (10%) -2.569506 dtype: float64
**p-value <= significance level (default: 0.05)** => we reject H(0) and our ts is stationary (ADF).
Analyze autocorrelation of the time series with ACF, PACF.
# 2 graphs side by side
fig, ax = plt.subplots(1, 2, figsize=(10, 4))
# ACF
plot_acf(train['y'], ax=ax[0], lags=20)
ax[0].set_title('ACF')
# PACF
plot_pacf(train['y'], ax=ax[1], lags=20)
ax[1].set_title('PACF')
plt.tight_layout()
plt.show()
ACF decays slowly linearly (outside the confidence interval), it suggests autocorrelation.
Significant PACF values only at the first few lags suggest the series may follow an autoregressive process. PACF values become near-zero after the first few lags, it indicates that autocorrelation is primarily explained by the initial lags.
Find best hyperparameters using grid serach and expanding window cross-validation
def linear_regression_model_init(params):
if params['standard_scaller']:
linear_regression_model = Pipeline(steps=[
('scaller', StandardScaler()),
('poly', PolynomialFeatures(params['polynomial'])),
('estimator', Ridge(alpha=params['ridge_alpha'], random_state=random_state)),
])
else:
linear_regression_model = Pipeline(steps=[
('poly', PolynomialFeatures(params['polynomial'])),
('estimator', Ridge(alpha=params['ridge_alpha'], random_state=random_state)),
])
return MLForecast(
freq='D',
models=[
linear_regression_model,
],
lags=params['lags'],
target_transforms=[Differences([1])]
)
def linear_regression_cv_score(model):
cv_results = model.cross_validation(
df = train,
h = 200,
step_size = 40,
n_windows = 5
)
cv_results = evaluate_cross_validation(cv_results, [mape])
return cv_results.loc['stock_id', 'mape']['Ridge']
grid_search_linear_regression = GridSearch(
all_params={
'lags':[[1], [1, 2], [1, 2, 3]],
'polynomial': [1, 2],
'standard_scaller': [True, False],
'ridge_alpha': [0.01, 0.1, 1, 10, 100]
},
model_initializer=linear_regression_model_init,
calculate_score=linear_regression_cv_score
)
grid_search_linear_regression.search()
Iteration: 1 of 60
Params: {'lags': [1], 'polynomial': 1, 'standard_scaller': True, 'ridge_alpha': 0.01}
Score: 0.20911131132312272
Iteration: 2 of 60
Params: {'lags': [1], 'polynomial': 1, 'standard_scaller': True, 'ridge_alpha': 0.1}
Score: 0.2091111316402034
Iteration: 3 of 60
Params: {'lags': [1], 'polynomial': 1, 'standard_scaller': True, 'ridge_alpha': 1}
Score: 0.20910934129980524
Iteration: 4 of 60
Params: {'lags': [1], 'polynomial': 1, 'standard_scaller': True, 'ridge_alpha': 10}
Score: 0.2090920638325259
Iteration: 5 of 60
Params: {'lags': [1], 'polynomial': 1, 'standard_scaller': True, 'ridge_alpha': 100}
Score: 0.20896510127159257
Iteration: 6 of 60
Params: {'lags': [1], 'polynomial': 1, 'standard_scaller': False, 'ridge_alpha': 0.01}
Score: 0.20911130140288706
Iteration: 7 of 60
Params: {'lags': [1], 'polynomial': 1, 'standard_scaller': False, 'ridge_alpha': 0.1}
Score: 0.20911103251946456
Iteration: 8 of 60
Params: {'lags': [1], 'polynomial': 1, 'standard_scaller': False, 'ridge_alpha': 1}
Score: 0.2091083581977255
Iteration: 9 of 60
Params: {'lags': [1], 'polynomial': 1, 'standard_scaller': False, 'ridge_alpha': 10}
Score: 0.2090829906431936
Iteration: 10 of 60
Params: {'lags': [1], 'polynomial': 1, 'standard_scaller': False, 'ridge_alpha': 100}
Score: 0.20891814999147273
Iteration: 11 of 60
Params: {'lags': [1], 'polynomial': 2, 'standard_scaller': True, 'ridge_alpha': 0.01}
Score: 0.20850349319010034
Iteration: 12 of 60
Params: {'lags': [1], 'polynomial': 2, 'standard_scaller': True, 'ridge_alpha': 0.1}
Score: 0.20850546634269884
Iteration: 13 of 60
Params: {'lags': [1], 'polynomial': 2, 'standard_scaller': True, 'ridge_alpha': 1}
Score: 0.20852511397665877
Iteration: 14 of 60
Params: {'lags': [1], 'polynomial': 2, 'standard_scaller': True, 'ridge_alpha': 10}
Score: 0.20871353039410517
Iteration: 15 of 60
Params: {'lags': [1], 'polynomial': 2, 'standard_scaller': True, 'ridge_alpha': 100}
Score: 0.21003153921468165
Iteration: 16 of 60
Params: {'lags': [1], 'polynomial': 2, 'standard_scaller': False, 'ridge_alpha': 0.01}
Score: 0.2085036504266946
Iteration: 17 of 60
Params: {'lags': [1], 'polynomial': 2, 'standard_scaller': False, 'ridge_alpha': 0.1}
Score: 0.20850703719052
Iteration: 18 of 60
Params: {'lags': [1], 'polynomial': 2, 'standard_scaller': False, 'ridge_alpha': 1}
Score: 0.20854067185601582
Iteration: 19 of 60
Params: {'lags': [1], 'polynomial': 2, 'standard_scaller': False, 'ridge_alpha': 10}
Score: 0.20885517968708758
Iteration: 20 of 60
Params: {'lags': [1], 'polynomial': 2, 'standard_scaller': False, 'ridge_alpha': 100}
Score: 0.21070094727251631
Iteration: 21 of 60
Params: {'lags': [1, 2], 'polynomial': 1, 'standard_scaller': True, 'ridge_alpha': 0.01}
Score: 0.20885274576747187
Iteration: 22 of 60
Params: {'lags': [1, 2], 'polynomial': 1, 'standard_scaller': True, 'ridge_alpha': 0.1}
Score: 0.20885263964653822
Iteration: 23 of 60
Params: {'lags': [1, 2], 'polynomial': 1, 'standard_scaller': True, 'ridge_alpha': 1}
Score: 0.20885158208758736
Iteration: 24 of 60
Params: {'lags': [1, 2], 'polynomial': 1, 'standard_scaller': True, 'ridge_alpha': 10}
Score: 0.20884135948285493
Iteration: 25 of 60
Params: {'lags': [1, 2], 'polynomial': 1, 'standard_scaller': True, 'ridge_alpha': 100}
Score: 0.20876543646151763
Iteration: 26 of 60
Params: {'lags': [1, 2], 'polynomial': 1, 'standard_scaller': False, 'ridge_alpha': 0.01}
Score: 0.20885274019468714
Iteration: 27 of 60
Params: {'lags': [1, 2], 'polynomial': 1, 'standard_scaller': False, 'ridge_alpha': 0.1}
Score: 0.2088525839611885
Iteration: 28 of 60
Params: {'lags': [1, 2], 'polynomial': 1, 'standard_scaller': False, 'ridge_alpha': 1}
Score: 0.20885102945646178
Iteration: 29 of 60
Params: {'lags': [1, 2], 'polynomial': 1, 'standard_scaller': False, 'ridge_alpha': 10}
Score: 0.20883623057684236
Iteration: 30 of 60
Params: {'lags': [1, 2], 'polynomial': 1, 'standard_scaller': False, 'ridge_alpha': 100}
Score: 0.20873808875042058
Iteration: 31 of 60
Params: {'lags': [1, 2], 'polynomial': 2, 'standard_scaller': True, 'ridge_alpha': 0.01}
Score: 0.20853693235162013
Iteration: 32 of 60
Params: {'lags': [1, 2], 'polynomial': 2, 'standard_scaller': True, 'ridge_alpha': 0.1}
Score: 0.20853869991928958
Iteration: 33 of 60
Params: {'lags': [1, 2], 'polynomial': 2, 'standard_scaller': True, 'ridge_alpha': 1}
Score: 0.2085563064005161
Iteration: 34 of 60
Params: {'lags': [1, 2], 'polynomial': 2, 'standard_scaller': True, 'ridge_alpha': 10}
Score: 0.20872571324944808
Iteration: 35 of 60
Params: {'lags': [1, 2], 'polynomial': 2, 'standard_scaller': True, 'ridge_alpha': 100}
Score: 0.20994113261096176
Iteration: 36 of 60
Params: {'lags': [1, 2], 'polynomial': 2, 'standard_scaller': False, 'ridge_alpha': 0.01}
Score: 0.20853708904577503
Iteration: 37 of 60
Params: {'lags': [1, 2], 'polynomial': 2, 'standard_scaller': False, 'ridge_alpha': 0.1}
Score: 0.208540265448418
Iteration: 38 of 60
Params: {'lags': [1, 2], 'polynomial': 2, 'standard_scaller': False, 'ridge_alpha': 1}
Score: 0.2085718215485835
Iteration: 39 of 60
Params: {'lags': [1, 2], 'polynomial': 2, 'standard_scaller': False, 'ridge_alpha': 10}
Score: 0.20886787073446672
Iteration: 40 of 60
Params: {'lags': [1, 2], 'polynomial': 2, 'standard_scaller': False, 'ridge_alpha': 100}
Score: 0.21064548173904435
Iteration: 41 of 60
Params: {'lags': [1, 2, 3], 'polynomial': 1, 'standard_scaller': True, 'ridge_alpha': 0.01}
Score: 0.20946533961726282
Iteration: 42 of 60
Params: {'lags': [1, 2, 3], 'polynomial': 1, 'standard_scaller': True, 'ridge_alpha': 0.1}
Score: 0.2094652052413291
Iteration: 43 of 60
Params: {'lags': [1, 2, 3], 'polynomial': 1, 'standard_scaller': True, 'ridge_alpha': 1}
Score: 0.20946386670849573
Iteration: 44 of 60
Params: {'lags': [1, 2, 3], 'polynomial': 1, 'standard_scaller': True, 'ridge_alpha': 10}
Score: 0.20945098481425148
Iteration: 45 of 60
Params: {'lags': [1, 2, 3], 'polynomial': 1, 'standard_scaller': True, 'ridge_alpha': 100}
Score: 0.20935853526532228
Iteration: 46 of 60
Params: {'lags': [1, 2, 3], 'polynomial': 1, 'standard_scaller': False, 'ridge_alpha': 0.01}
Score: 0.20946533340876888
Iteration: 47 of 60
Params: {'lags': [1, 2, 3], 'polynomial': 1, 'standard_scaller': False, 'ridge_alpha': 0.1}
Score: 0.2094651432101101
Iteration: 48 of 60
Params: {'lags': [1, 2, 3], 'polynomial': 1, 'standard_scaller': False, 'ridge_alpha': 1}
Score: 0.20946325173055264
Iteration: 49 of 60
Params: {'lags': [1, 2, 3], 'polynomial': 1, 'standard_scaller': False, 'ridge_alpha': 10}
Score: 0.2094453333087695
Iteration: 50 of 60
Params: {'lags': [1, 2, 3], 'polynomial': 1, 'standard_scaller': False, 'ridge_alpha': 100}
Score: 0.20933047158511334
Iteration: 51 of 60
Params: {'lags': [1, 2, 3], 'polynomial': 2, 'standard_scaller': True, 'ridge_alpha': 0.01}
Score: 0.2124074558917921
Iteration: 52 of 60
Params: {'lags': [1, 2, 3], 'polynomial': 2, 'standard_scaller': True, 'ridge_alpha': 0.1}
Score: 0.21240886287050334
Iteration: 53 of 60
Params: {'lags': [1, 2, 3], 'polynomial': 2, 'standard_scaller': True, 'ridge_alpha': 1}
Score: 0.21242285488922202
Iteration: 54 of 60
Params: {'lags': [1, 2, 3], 'polynomial': 2, 'standard_scaller': True, 'ridge_alpha': 10}
Score: 0.21255550845905918
Iteration: 55 of 60
Params: {'lags': [1, 2, 3], 'polynomial': 2, 'standard_scaller': True, 'ridge_alpha': 100}
Score: 0.21343769199943607
Iteration: 56 of 60
Params: {'lags': [1, 2, 3], 'polynomial': 2, 'standard_scaller': False, 'ridge_alpha': 0.01}
Score: 0.21240764808854426
Iteration: 57 of 60
Params: {'lags': [1, 2, 3], 'polynomial': 2, 'standard_scaller': False, 'ridge_alpha': 0.1}
Score: 0.21241078181062817
Iteration: 58 of 60
Params: {'lags': [1, 2, 3], 'polynomial': 2, 'standard_scaller': False, 'ridge_alpha': 1}
Score: 0.21244174635021054
Iteration: 59 of 60
Params: {'lags': [1, 2, 3], 'polynomial': 2, 'standard_scaller': False, 'ridge_alpha': 10}
Score: 0.212718723957374
Iteration: 60 of 60
Params: {'lags': [1, 2, 3], 'polynomial': 2, 'standard_scaller': False, 'ridge_alpha': 100}
Score: 0.2140486006738273
Best score: 0.20850349319010034
with params {'lags': [1], 'polynomial': 2, 'standard_scaller': True, 'ridge_alpha': 0.01}
grid_search_linear_regression.display_results()
| score | lags | polynomial | standard_scaller | ridge_alpha | |
|---|---|---|---|---|---|
| 10 | 0.208503 | [1] | 2 | True | 0.01 |
| 15 | 0.208504 | [1] | 2 | False | 0.01 |
| 11 | 0.208505 | [1] | 2 | True | 0.10 |
| 16 | 0.208507 | [1] | 2 | False | 0.10 |
| 12 | 0.208525 | [1] | 2 | True | 1.00 |
| 30 | 0.208537 | [1, 2] | 2 | True | 0.01 |
| 35 | 0.208537 | [1, 2] | 2 | False | 0.01 |
| 31 | 0.208539 | [1, 2] | 2 | True | 0.10 |
| 36 | 0.208540 | [1, 2] | 2 | False | 0.10 |
| 17 | 0.208541 | [1] | 2 | False | 1.00 |
| 32 | 0.208556 | [1, 2] | 2 | True | 1.00 |
| 37 | 0.208572 | [1, 2] | 2 | False | 1.00 |
| 13 | 0.208714 | [1] | 2 | True | 10.00 |
| 33 | 0.208726 | [1, 2] | 2 | True | 10.00 |
| 29 | 0.208738 | [1, 2] | 1 | False | 100.00 |
| 24 | 0.208765 | [1, 2] | 1 | True | 100.00 |
| 28 | 0.208836 | [1, 2] | 1 | False | 10.00 |
| 23 | 0.208841 | [1, 2] | 1 | True | 10.00 |
| 27 | 0.208851 | [1, 2] | 1 | False | 1.00 |
| 22 | 0.208852 | [1, 2] | 1 | True | 1.00 |
| 26 | 0.208853 | [1, 2] | 1 | False | 0.10 |
| 21 | 0.208853 | [1, 2] | 1 | True | 0.10 |
| 25 | 0.208853 | [1, 2] | 1 | False | 0.01 |
| 20 | 0.208853 | [1, 2] | 1 | True | 0.01 |
| 18 | 0.208855 | [1] | 2 | False | 10.00 |
| 38 | 0.208868 | [1, 2] | 2 | False | 10.00 |
| 9 | 0.208918 | [1] | 1 | False | 100.00 |
| 4 | 0.208965 | [1] | 1 | True | 100.00 |
| 8 | 0.209083 | [1] | 1 | False | 10.00 |
| 3 | 0.209092 | [1] | 1 | True | 10.00 |
| 7 | 0.209108 | [1] | 1 | False | 1.00 |
| 2 | 0.209109 | [1] | 1 | True | 1.00 |
| 6 | 0.209111 | [1] | 1 | False | 0.10 |
| 1 | 0.209111 | [1] | 1 | True | 0.10 |
| 5 | 0.209111 | [1] | 1 | False | 0.01 |
| 0 | 0.209111 | [1] | 1 | True | 0.01 |
| 49 | 0.209330 | [1, 2, 3] | 1 | False | 100.00 |
| 44 | 0.209359 | [1, 2, 3] | 1 | True | 100.00 |
| 48 | 0.209445 | [1, 2, 3] | 1 | False | 10.00 |
| 43 | 0.209451 | [1, 2, 3] | 1 | True | 10.00 |
| 47 | 0.209463 | [1, 2, 3] | 1 | False | 1.00 |
| 42 | 0.209464 | [1, 2, 3] | 1 | True | 1.00 |
| 46 | 0.209465 | [1, 2, 3] | 1 | False | 0.10 |
| 41 | 0.209465 | [1, 2, 3] | 1 | True | 0.10 |
| 45 | 0.209465 | [1, 2, 3] | 1 | False | 0.01 |
| 40 | 0.209465 | [1, 2, 3] | 1 | True | 0.01 |
| 34 | 0.209941 | [1, 2] | 2 | True | 100.00 |
| 14 | 0.210032 | [1] | 2 | True | 100.00 |
| 39 | 0.210645 | [1, 2] | 2 | False | 100.00 |
| 19 | 0.210701 | [1] | 2 | False | 100.00 |
| 50 | 0.212407 | [1, 2, 3] | 2 | True | 0.01 |
| 55 | 0.212408 | [1, 2, 3] | 2 | False | 0.01 |
| 51 | 0.212409 | [1, 2, 3] | 2 | True | 0.10 |
| 56 | 0.212411 | [1, 2, 3] | 2 | False | 0.10 |
| 52 | 0.212423 | [1, 2, 3] | 2 | True | 1.00 |
| 57 | 0.212442 | [1, 2, 3] | 2 | False | 1.00 |
| 53 | 0.212556 | [1, 2, 3] | 2 | True | 10.00 |
| 58 | 0.212719 | [1, 2, 3] | 2 | False | 10.00 |
| 54 | 0.213438 | [1, 2, 3] | 2 | True | 100.00 |
| 59 | 0.214049 | [1, 2, 3] | 2 | False | 100.00 |
Let's fit the best model
linear_regression_model = linear_regression_model_init(grid_search_linear_regression.get_best_params())
linear_regression_model.fit(train, fitted=True)
MLForecast(models=[Ridge], freq=D, lag_features=['lag1'], date_features=[], num_threads=1)
Plot and analyze residuals of the model
Residuals of the model: $e_t = y_t - \hat{y_t}$
In the best case: residuals are not autocorrelated and have zero mean.
fitted_predictions = linear_regression_model.forecast_fitted_values()
fitted_predictions['residuals'] = fitted_predictions['y'] - fitted_predictions['Ridge']
plot_residuals(fitted_predictions['residuals'])
Residuals Plot - top left
What to look for?
In our case
Residuals have a zero mean but does not have constant variance
Histogram plus estimated density - top right
What to look for?
In our case
The model might be overfitting certain parts of the data, leading to small residuals in some regions and large residuals in others
Normal Q-Q Plot - bottom left
What to look for?
In our case
There are curves or deviations at the ends of the Q-Q plot (both the upper and lower tails), it suggests that our data may have fat tails (kurtosis) or more extreme values than a normal distribution would predict.
Correlogram - bottom right
The autocorrelation function (ACF) of the residuals, showing how correlated residuals are at different lags.
Out-of-sample forecasts
predictions = linear_regression_model.predict(len(test))
predictions.set_index(test.index, inplace=True)
fig = px.line(title="Nvidia closing prices (daily)")
fig.add_scatter(x=train['ds'], y=train['y'], mode='lines', name='train', line=dict(color='blue'))
fig.add_scatter(x=test['ds'], y=test['y'], mode='lines', name='test', line=dict(color='green'))
fig.add_scatter(x=predictions['ds'], y=predictions['Ridge'], mode='lines', name='prediction', line=dict(color='red'))
fig.update_layout(template='plotly_white', width=1000, height=500)
fig.update_xaxes(title_text="date")
fig.update_yaxes(title_text="closing price")
fig.show()
We can calculate quality metric by using MAPE
$$\text{ Mean absolute percentage error: } MAPE = mean(\frac{|y_t - \hat{y_t}|}{y_t})$$It has intuitive appeal and is suitable for this time series because:
lineral_regression_mape = my_mape(predictions['Ridge'], test['y'])
model_metrics_logger.info(
f'Model name: Ridge, MAPE score: {lineral_regression_mape}, random_state: {random_state}, hyperparameters: {grid_search_linear_regression.get_best_params()}'
)
Model name: Ridge, MAPE score: 6.104782628986853, random_state: 42, hyperparameters: {'lags': [1], 'polynomial': 2, 'standard_scaller': True, 'ridge_alpha': 0.01}
Let's do the same for remaning models
Find best hyperparameters using grid serach and expanding window cross-validation
def xgboost_model_init(params):
return MLForecast(
freq='D',
models=[
xgb.XGBRegressor(
objective='reg:squarederror',
random_state=random_state,
max_depth=params['max_depth'],
reg_lambda=params['reg_lambda'],
eta=params['eta']
)
],
lags=params['lags'],
target_transforms=[Differences([1])]
)
def xgboost_cv_score(model):
cv_results = model.cross_validation(
df = train,
h = 200,
step_size = 40,
n_windows = 5
)
cv_results = evaluate_cross_validation(cv_results, [mape])
return cv_results.loc['stock_id', 'mape']['XGBRegressor']
xgboost_grid_search = GridSearch(
all_params={
'lags':[[1, 2, 3, 4, 5]],
'max_depth': [2, 4, 6],
'reg_lambda': [0.01, 0.1, 1, 10, 100],
'eta': [0.2, 0.3, 0.4]
},
model_initializer=xgboost_model_init,
calculate_score=xgboost_cv_score
)
xgboost_grid_search.search()
Iteration: 1 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 2, 'reg_lambda': 0.01, 'eta': 0.2}
Score: 0.21496090241549845
Iteration: 2 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 2, 'reg_lambda': 0.01, 'eta': 0.3}
Score: 0.2091375652148184
Iteration: 3 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 2, 'reg_lambda': 0.01, 'eta': 0.4}
Score: 0.1770481708395748
Iteration: 4 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 2, 'reg_lambda': 0.1, 'eta': 0.2}
Score: 0.21807720901071428
Iteration: 5 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 2, 'reg_lambda': 0.1, 'eta': 0.3}
Score: 0.22219061187735906
Iteration: 6 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 2, 'reg_lambda': 0.1, 'eta': 0.4}
Score: 0.19924969465729603
Iteration: 7 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 2, 'reg_lambda': 1, 'eta': 0.2}
Score: 0.21317747838860407
Iteration: 8 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 2, 'reg_lambda': 1, 'eta': 0.3}
Score: 0.23131812310922614
Iteration: 9 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 2, 'reg_lambda': 1, 'eta': 0.4}
Score: 0.20222303289053212
Iteration: 10 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 2, 'reg_lambda': 10, 'eta': 0.2}
Score: 0.1967312563403099
Iteration: 11 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 2, 'reg_lambda': 10, 'eta': 0.3}
Score: 0.19177274043863582
Iteration: 12 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 2, 'reg_lambda': 10, 'eta': 0.4}
Score: 0.20283706121393932
Iteration: 13 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 2, 'reg_lambda': 100, 'eta': 0.2}
Score: 0.1974831426099958
Iteration: 14 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 2, 'reg_lambda': 100, 'eta': 0.3}
Score: 0.19029211659589182
Iteration: 15 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 2, 'reg_lambda': 100, 'eta': 0.4}
Score: 0.1900599558983575
Iteration: 16 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 4, 'reg_lambda': 0.01, 'eta': 0.2}
Score: 0.23667772467268477
Iteration: 17 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 4, 'reg_lambda': 0.01, 'eta': 0.3}
Score: 0.21597653815092918
Iteration: 18 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 4, 'reg_lambda': 0.01, 'eta': 0.4}
Score: 0.23940994745685326
Iteration: 19 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 4, 'reg_lambda': 0.1, 'eta': 0.2}
Score: 0.20850908536838525
Iteration: 20 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 4, 'reg_lambda': 0.1, 'eta': 0.3}
Score: 0.2169898345832431
Iteration: 21 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 4, 'reg_lambda': 0.1, 'eta': 0.4}
Score: 0.2144278962259493
Iteration: 22 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 4, 'reg_lambda': 1, 'eta': 0.2}
Score: 0.2235975014582839
Iteration: 23 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 4, 'reg_lambda': 1, 'eta': 0.3}
Score: 0.2079727173266454
Iteration: 24 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 4, 'reg_lambda': 1, 'eta': 0.4}
Score: 0.20634182566389686
Iteration: 25 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 4, 'reg_lambda': 10, 'eta': 0.2}
Score: 0.17300700467801663
Iteration: 26 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 4, 'reg_lambda': 10, 'eta': 0.3}
Score: 0.17878277774715495
Iteration: 27 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 4, 'reg_lambda': 10, 'eta': 0.4}
Score: 0.19376698152812116
Iteration: 28 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 4, 'reg_lambda': 100, 'eta': 0.2}
Score: 0.19278458049844813
Iteration: 29 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 4, 'reg_lambda': 100, 'eta': 0.3}
Score: 0.1876839170343645
Iteration: 30 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 4, 'reg_lambda': 100, 'eta': 0.4}
Score: 0.20122164675218449
Iteration: 31 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 6, 'reg_lambda': 0.01, 'eta': 0.2}
Score: 0.1924537335858931
Iteration: 32 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 6, 'reg_lambda': 0.01, 'eta': 0.3}
Score: 0.19504338245705935
Iteration: 33 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 6, 'reg_lambda': 0.01, 'eta': 0.4}
Score: 0.1693674819642384
Iteration: 34 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 6, 'reg_lambda': 0.1, 'eta': 0.2}
Score: 0.21870366193769036
Iteration: 35 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 6, 'reg_lambda': 0.1, 'eta': 0.3}
Score: 0.1987810877530689
Iteration: 36 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 6, 'reg_lambda': 0.1, 'eta': 0.4}
Score: 0.19202114630864497
Iteration: 37 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 6, 'reg_lambda': 1, 'eta': 0.2}
Score: 0.2051947840320994
Iteration: 38 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 6, 'reg_lambda': 1, 'eta': 0.3}
Score: 0.18525838579034684
Iteration: 39 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 6, 'reg_lambda': 1, 'eta': 0.4}
Score: 0.1993262815355879
Iteration: 40 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 6, 'reg_lambda': 10, 'eta': 0.2}
Score: 0.19964462079849568
Iteration: 41 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 6, 'reg_lambda': 10, 'eta': 0.3}
Score: 0.1896809931303151
Iteration: 42 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 6, 'reg_lambda': 10, 'eta': 0.4}
Score: 0.18649161594524422
Iteration: 43 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 6, 'reg_lambda': 100, 'eta': 0.2}
Score: 0.2014185615681492
Iteration: 44 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 6, 'reg_lambda': 100, 'eta': 0.3}
Score: 0.18859486100557804
Iteration: 45 of 45
Params: {'lags': [1, 2, 3, 4, 5], 'max_depth': 6, 'reg_lambda': 100, 'eta': 0.4}
Score: 0.18934122521420732
Best score: 0.1693674819642384
with params {'lags': [1, 2, 3, 4, 5], 'max_depth': 6, 'reg_lambda': 0.01, 'eta': 0.4}
xgboost_grid_search.display_results()
| score | lags | max_depth | reg_lambda | eta | |
|---|---|---|---|---|---|
| 32 | 0.169367 | [1, 2, 3, 4, 5] | 6 | 0.01 | 0.4 |
| 24 | 0.173007 | [1, 2, 3, 4, 5] | 4 | 10.00 | 0.2 |
| 2 | 0.177048 | [1, 2, 3, 4, 5] | 2 | 0.01 | 0.4 |
| 25 | 0.178783 | [1, 2, 3, 4, 5] | 4 | 10.00 | 0.3 |
| 37 | 0.185258 | [1, 2, 3, 4, 5] | 6 | 1.00 | 0.3 |
| 41 | 0.186492 | [1, 2, 3, 4, 5] | 6 | 10.00 | 0.4 |
| 28 | 0.187684 | [1, 2, 3, 4, 5] | 4 | 100.00 | 0.3 |
| 43 | 0.188595 | [1, 2, 3, 4, 5] | 6 | 100.00 | 0.3 |
| 44 | 0.189341 | [1, 2, 3, 4, 5] | 6 | 100.00 | 0.4 |
| 40 | 0.189681 | [1, 2, 3, 4, 5] | 6 | 10.00 | 0.3 |
| 14 | 0.190060 | [1, 2, 3, 4, 5] | 2 | 100.00 | 0.4 |
| 13 | 0.190292 | [1, 2, 3, 4, 5] | 2 | 100.00 | 0.3 |
| 10 | 0.191773 | [1, 2, 3, 4, 5] | 2 | 10.00 | 0.3 |
| 35 | 0.192021 | [1, 2, 3, 4, 5] | 6 | 0.10 | 0.4 |
| 30 | 0.192454 | [1, 2, 3, 4, 5] | 6 | 0.01 | 0.2 |
| 27 | 0.192785 | [1, 2, 3, 4, 5] | 4 | 100.00 | 0.2 |
| 26 | 0.193767 | [1, 2, 3, 4, 5] | 4 | 10.00 | 0.4 |
| 31 | 0.195043 | [1, 2, 3, 4, 5] | 6 | 0.01 | 0.3 |
| 9 | 0.196731 | [1, 2, 3, 4, 5] | 2 | 10.00 | 0.2 |
| 12 | 0.197483 | [1, 2, 3, 4, 5] | 2 | 100.00 | 0.2 |
| 34 | 0.198781 | [1, 2, 3, 4, 5] | 6 | 0.10 | 0.3 |
| 5 | 0.199250 | [1, 2, 3, 4, 5] | 2 | 0.10 | 0.4 |
| 38 | 0.199326 | [1, 2, 3, 4, 5] | 6 | 1.00 | 0.4 |
| 39 | 0.199645 | [1, 2, 3, 4, 5] | 6 | 10.00 | 0.2 |
| 29 | 0.201222 | [1, 2, 3, 4, 5] | 4 | 100.00 | 0.4 |
| 42 | 0.201419 | [1, 2, 3, 4, 5] | 6 | 100.00 | 0.2 |
| 8 | 0.202223 | [1, 2, 3, 4, 5] | 2 | 1.00 | 0.4 |
| 11 | 0.202837 | [1, 2, 3, 4, 5] | 2 | 10.00 | 0.4 |
| 36 | 0.205195 | [1, 2, 3, 4, 5] | 6 | 1.00 | 0.2 |
| 23 | 0.206342 | [1, 2, 3, 4, 5] | 4 | 1.00 | 0.4 |
| 22 | 0.207973 | [1, 2, 3, 4, 5] | 4 | 1.00 | 0.3 |
| 18 | 0.208509 | [1, 2, 3, 4, 5] | 4 | 0.10 | 0.2 |
| 1 | 0.209138 | [1, 2, 3, 4, 5] | 2 | 0.01 | 0.3 |
| 6 | 0.213177 | [1, 2, 3, 4, 5] | 2 | 1.00 | 0.2 |
| 20 | 0.214428 | [1, 2, 3, 4, 5] | 4 | 0.10 | 0.4 |
| 0 | 0.214961 | [1, 2, 3, 4, 5] | 2 | 0.01 | 0.2 |
| 16 | 0.215977 | [1, 2, 3, 4, 5] | 4 | 0.01 | 0.3 |
| 19 | 0.216990 | [1, 2, 3, 4, 5] | 4 | 0.10 | 0.3 |
| 3 | 0.218077 | [1, 2, 3, 4, 5] | 2 | 0.10 | 0.2 |
| 33 | 0.218704 | [1, 2, 3, 4, 5] | 6 | 0.10 | 0.2 |
| 4 | 0.222191 | [1, 2, 3, 4, 5] | 2 | 0.10 | 0.3 |
| 21 | 0.223598 | [1, 2, 3, 4, 5] | 4 | 1.00 | 0.2 |
| 7 | 0.231318 | [1, 2, 3, 4, 5] | 2 | 1.00 | 0.3 |
| 15 | 0.236678 | [1, 2, 3, 4, 5] | 4 | 0.01 | 0.2 |
| 17 | 0.239410 | [1, 2, 3, 4, 5] | 4 | 0.01 | 0.4 |
Let's fit the best model
xgboost_model = xgboost_model_init(xgboost_grid_search.get_best_params())
xgboost_model.fit(train, fitted=True)
MLForecast(models=[XGBRegressor], freq=D, lag_features=['lag1', 'lag2', 'lag3', 'lag4', 'lag5'], date_features=[], num_threads=1)
Plot and analyze residuals of the model
fitted_xgboost_predictions = xgboost_model.forecast_fitted_values()
fitted_xgboost_predictions['residuals'] = fitted_xgboost_predictions['y'] - fitted_xgboost_predictions['XGBRegressor']
plot_residuals(fitted_xgboost_predictions['residuals'])
Out-of-sample forecasts
xgboost_predictions = xgboost_model.predict(len(test))
xgboost_predictions.set_index(test.index, inplace=True)
fig = px.line(title="Nvidia closing prices (daily)")
fig.add_scatter(x=train['ds'], y=train['y'], mode='lines', name='train', line=dict(color='blue'))
fig.add_scatter(x=test['ds'], y=test['y'], mode='lines', name='test', line=dict(color='green'))
fig.add_scatter(x=xgboost_predictions['ds'], y=xgboost_predictions['XGBRegressor'], mode='lines', name='prediction', line=dict(color='red'))
fig.update_layout(template='plotly_white', width=1000, height=500)
fig.update_xaxes(title_text="date")
fig.update_yaxes(title_text="closing price")
fig.show()
Calculate quality metric by using MAPE
xgboost_mape = my_mape(xgboost_predictions['XGBRegressor'], test['y'])
model_metrics_logger.info(
f'Model name: XGBoost, MAPE score: {xgboost_mape}, random_state: {random_state}, hyperparameters: {xgboost_grid_search.get_best_params()}'
)
Model name: XGBoost, MAPE score: 6.767184200955984, random_state: 42, hyperparameters: {'lags': [1, 2, 3, 4, 5], 'max_depth': 6, 'reg_lambda': 0.01, 'eta': 0.4}
Find best hyperparameters using grid serach and expanding window cross-validation
def ltsm_model_init(params):
return NeuralForecast(
freq='D',
models=[
LSTM(
h=len(test), # Forecast horizon
max_steps=100, # Number of steps to train
scaler_type='standard', # Type of scaler to normalize data
encoder_hidden_size=params['encoder_hidden_size'],#64, # Defines the size of the hidden state of the LSTM
decoder_hidden_size=params['decoder_hidden_size'],#64,
context_size=params['context_size'],#10,
encoder_dropout=params['encoder_dropout'],#0,
learning_rate=0.001,
random_seed=random_state
)
]
)
def ltsm_cv_score(model):
cv_results = model.cross_validation(
df = train,
step_size = 40,
n_windows = 5,
refit=True
)
cv_results = evaluate_cross_validation(cv_results, [mape])
return cv_results.loc['stock_id', 'mape']['LSTM']
ltsm_grid_search = GridSearch(
all_params={
'encoder_hidden_size': [32, 64, 128],
'decoder_hidden_size': [32, 64, 128],
'context_size': [5, 10, 20],
'encoder_dropout': [0, 0.2, 0.4],
},
model_initializer=ltsm_model_init,
calculate_score=ltsm_cv_score
)
ltsm_grid_search.search()
Seed set to 42
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 1 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 32, 'context_size': 5, 'encoder_dropout': 0}
Score: 0.2884957499936637
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 2 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 32, 'context_size': 5, 'encoder_dropout': 0.2}
Score: 0.30166758532304483
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 3 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 32, 'context_size': 5, 'encoder_dropout': 0.4}
Score: 0.2939357610261316
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 4 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 32, 'context_size': 10, 'encoder_dropout': 0}
Score: 0.2595300785344849
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 5 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 32, 'context_size': 10, 'encoder_dropout': 0.2}
Score: 0.28313232860277165
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 6 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 32, 'context_size': 10, 'encoder_dropout': 0.4}
Score: 0.28229920758834265
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 7 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 32, 'context_size': 20, 'encoder_dropout': 0}
Score: 0.2866209993092649
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 8 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 32, 'context_size': 20, 'encoder_dropout': 0.2}
Score: 0.2962588319386933
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 9 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 32, 'context_size': 20, 'encoder_dropout': 0.4}
Score: 0.29612182144864074
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 10 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 64, 'context_size': 5, 'encoder_dropout': 0}
Score: 0.27962552256669937
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 11 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 64, 'context_size': 5, 'encoder_dropout': 0.2}
Score: 0.2964242905414459
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 12 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 64, 'context_size': 5, 'encoder_dropout': 0.4}
Score: 0.3070683411562892
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 13 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 64, 'context_size': 10, 'encoder_dropout': 0}
Score: 0.2889953221749292
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 14 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 64, 'context_size': 10, 'encoder_dropout': 0.2}
Score: 0.29393602872832614
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 15 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 64, 'context_size': 10, 'encoder_dropout': 0.4}
Score: 0.2833101888397487
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 16 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 64, 'context_size': 20, 'encoder_dropout': 0}
Score: 0.2637828216706331
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 17 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 64, 'context_size': 20, 'encoder_dropout': 0.2}
Score: 0.27033330580981224
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 18 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 64, 'context_size': 20, 'encoder_dropout': 0.4}
Score: 0.2777040544729802
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 19 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 128, 'context_size': 5, 'encoder_dropout': 0}
Score: 0.2882137218135076
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 20 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 128, 'context_size': 5, 'encoder_dropout': 0.2}
Score: 0.31453330316528405
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 21 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 128, 'context_size': 5, 'encoder_dropout': 0.4}
Score: 0.29505128747027076
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 22 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 128, 'context_size': 10, 'encoder_dropout': 0}
Score: 0.2945737500972734
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 23 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 128, 'context_size': 10, 'encoder_dropout': 0.2}
Score: 0.3038521819007395
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 24 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 128, 'context_size': 10, 'encoder_dropout': 0.4}
Score: 0.31254942033131183
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 25 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 128, 'context_size': 20, 'encoder_dropout': 0}
Score: 0.367102851525001
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 26 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 128, 'context_size': 20, 'encoder_dropout': 0.2}
Score: 0.31029206977532764
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 27 of 81
Params: {'encoder_hidden_size': 32, 'decoder_hidden_size': 128, 'context_size': 20, 'encoder_dropout': 0.4}
Score: 0.31458235923766553
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 28 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 32, 'context_size': 5, 'encoder_dropout': 0}
Score: 0.29165542582515974
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 29 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 32, 'context_size': 5, 'encoder_dropout': 0.2}
Score: 0.2901934450186943
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 30 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 32, 'context_size': 5, 'encoder_dropout': 0.4}
Score: 0.2894535278161915
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 31 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 32, 'context_size': 10, 'encoder_dropout': 0}
Score: 0.27535394596405227
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 32 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 32, 'context_size': 10, 'encoder_dropout': 0.2}
Score: 0.2743197913263732
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 33 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 32, 'context_size': 10, 'encoder_dropout': 0.4}
Score: 0.2712739736208148
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 34 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 32, 'context_size': 20, 'encoder_dropout': 0}
Score: 0.24754821057335277
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 35 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 32, 'context_size': 20, 'encoder_dropout': 0.2}
Score: 0.25443095472654464
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 36 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 32, 'context_size': 20, 'encoder_dropout': 0.4}
Score: 0.2590707092305283
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 37 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 64, 'context_size': 5, 'encoder_dropout': 0}
Score: 0.2581734293910435
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 38 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 64, 'context_size': 5, 'encoder_dropout': 0.2}
Score: 0.26026407112443267
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 39 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 64, 'context_size': 5, 'encoder_dropout': 0.4}
Score: 0.2627136362665432
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 40 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 64, 'context_size': 10, 'encoder_dropout': 0}
Score: 0.2570037099592431
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 41 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 64, 'context_size': 10, 'encoder_dropout': 0.2}
Score: 0.2616292576843964
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 42 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 64, 'context_size': 10, 'encoder_dropout': 0.4}
Score: 0.26596559257686214
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 43 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 64, 'context_size': 20, 'encoder_dropout': 0}
Score: 0.22918461661096928
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 44 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 64, 'context_size': 20, 'encoder_dropout': 0.2}
Score: 0.23104414932812736
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 45 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 64, 'context_size': 20, 'encoder_dropout': 0.4}
Score: 0.23413912638958917
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 46 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 128, 'context_size': 5, 'encoder_dropout': 0}
Score: 0.24404878300370553
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 47 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 128, 'context_size': 5, 'encoder_dropout': 0.2}
Score: 0.2535658650429257
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 48 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 128, 'context_size': 5, 'encoder_dropout': 0.4}
Score: 0.2502922327442781
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 49 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 128, 'context_size': 10, 'encoder_dropout': 0}
Score: 0.26634385557961016
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 50 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 128, 'context_size': 10, 'encoder_dropout': 0.2}
Score: 0.2730802113982901
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 51 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 128, 'context_size': 10, 'encoder_dropout': 0.4}
Score: 0.29362105863495336
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 52 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 128, 'context_size': 20, 'encoder_dropout': 0}
Score: 0.27289511384998255
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 53 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 128, 'context_size': 20, 'encoder_dropout': 0.2}
Score: 0.3274973420053127
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 54 of 81
Params: {'encoder_hidden_size': 64, 'decoder_hidden_size': 128, 'context_size': 20, 'encoder_dropout': 0.4}
Score: 0.3135277912488804
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 55 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 32, 'context_size': 5, 'encoder_dropout': 0}
Score: 0.27598748140740126
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 56 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 32, 'context_size': 5, 'encoder_dropout': 0.2}
Score: 0.26305390314814864
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 57 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 32, 'context_size': 5, 'encoder_dropout': 0.4}
Score: 0.259876149795318
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 58 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 32, 'context_size': 10, 'encoder_dropout': 0}
Score: 0.2359523282742127
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 59 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 32, 'context_size': 10, 'encoder_dropout': 0.2}
Score: 0.23927903316004495
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 60 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 32, 'context_size': 10, 'encoder_dropout': 0.4}
Score: 0.2590463067241452
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 61 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 32, 'context_size': 20, 'encoder_dropout': 0}
Score: 0.24973422011181556
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 62 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 32, 'context_size': 20, 'encoder_dropout': 0.2}
Score: 0.2552779181149151
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 63 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 32, 'context_size': 20, 'encoder_dropout': 0.4}
Score: 0.2583330821728446
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 64 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 64, 'context_size': 5, 'encoder_dropout': 0}
Score: 0.24731846484990752
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 65 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 64, 'context_size': 5, 'encoder_dropout': 0.2}
Score: 0.25222101807212033
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 66 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 64, 'context_size': 5, 'encoder_dropout': 0.4}
Score: 0.25136637961860975
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 67 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 64, 'context_size': 10, 'encoder_dropout': 0}
Score: 0.24956906692125616
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 68 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 64, 'context_size': 10, 'encoder_dropout': 0.2}
Score: 0.25019970602420094
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 69 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 64, 'context_size': 10, 'encoder_dropout': 0.4}
Score: 0.253033474267363
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 70 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 64, 'context_size': 20, 'encoder_dropout': 0}
Score: 0.24120800876972934
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 71 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 64, 'context_size': 20, 'encoder_dropout': 0.2}
Score: 0.24514661762925463
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 72 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 64, 'context_size': 20, 'encoder_dropout': 0.4}
Score: 0.23731020985977264
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 73 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 128, 'context_size': 5, 'encoder_dropout': 0}
Score: 0.2385994028556888
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 74 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 128, 'context_size': 5, 'encoder_dropout': 0.2}
Score: 0.24485091382351873
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 75 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 128, 'context_size': 5, 'encoder_dropout': 0.4}
Score: 0.253172787480764
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 76 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 128, 'context_size': 10, 'encoder_dropout': 0}
Score: 0.22841658539636517
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 77 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 128, 'context_size': 10, 'encoder_dropout': 0.2}
Score: 0.23660555551010357
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 78 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 128, 'context_size': 10, 'encoder_dropout': 0.4}
Score: 0.24845452810862065
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 79 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 128, 'context_size': 20, 'encoder_dropout': 0}
Score: 0.2357067425886835
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Seed set to 42
Iteration: 80 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 128, 'context_size': 20, 'encoder_dropout': 0.2}
Score: 0.26721161544541816
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Predicting: | | 0/? [00:00<…
Iteration: 81 of 81
Params: {'encoder_hidden_size': 128, 'decoder_hidden_size': 128, 'context_size': 20, 'encoder_dropout': 0.4}
Score: 0.24383582922909022
Best score: 0.22841658539636517
with params {'encoder_hidden_size': 128, 'decoder_hidden_size': 128, 'context_size': 10, 'encoder_dropout': 0}
ltsm_grid_search.display_results()
| score | encoder_hidden_size | decoder_hidden_size | context_size | encoder_dropout | |
|---|---|---|---|---|---|
| 75 | 0.228417 | 128 | 128 | 10 | 0.0 |
| 42 | 0.229185 | 64 | 64 | 20 | 0.0 |
| 43 | 0.231044 | 64 | 64 | 20 | 0.2 |
| 44 | 0.234139 | 64 | 64 | 20 | 0.4 |
| 78 | 0.235707 | 128 | 128 | 20 | 0.0 |
| ... | ... | ... | ... | ... | ... |
| 53 | 0.313528 | 64 | 128 | 20 | 0.4 |
| 19 | 0.314533 | 32 | 128 | 5 | 0.2 |
| 26 | 0.314582 | 32 | 128 | 20 | 0.4 |
| 52 | 0.327497 | 64 | 128 | 20 | 0.2 |
| 24 | 0.367103 | 32 | 128 | 20 | 0.0 |
81 rows × 5 columns
Let's fit the best model
ltsm_model = ltsm_model_init(ltsm_grid_search.get_best_params())
ltsm_model.fit(train)
Seed set to 42
Sanity Checking: | | 0/? [00:00<…
Training: | | 0/? [00:00<…
Validation: | | 0/? [00:00<…
Out-of-sample forecasts
ltsm_predictions = ltsm_model.predict()
ltsm_predictions.set_index(test.index, inplace=True)
Predicting: | | 0/? [00:00<…
fig = px.line(title="Nvidia closing prices (daily)")
fig.add_scatter(x=train['ds'], y=train['y'], mode='lines', name='train', line=dict(color='blue'))
fig.add_scatter(x=test['ds'], y=test['y'], mode='lines', name='test', line=dict(color='green'))
fig.add_scatter(x=ltsm_predictions['ds'], y=ltsm_predictions['LSTM'], mode='lines', name='prediction', line=dict(color='red'))
fig.update_layout(template='plotly_white', width=1000, height=500)
fig.update_xaxes(title_text="date")
fig.update_yaxes(title_text="closing price")
fig.show()
Calculate quality metric by using MAPE
ltsm_mape = my_mape(ltsm_predictions['LSTM'], test['y'])
model_metrics_logger.info(
f'Model name: LSTM, MAPE score: {ltsm_mape}, random_state: {random_state}, hyperparameters: {ltsm_grid_search.get_best_params()}'
)
Model name: LSTM, MAPE score: 7.760950895078518, random_state: 42, hyperparameters: {'encoder_hidden_size': 128, 'decoder_hidden_size': 128, 'context_size': 10, 'encoder_dropout': 0}
Find best hyperparameters using grid serach and expanding window cross-validation
def arima_model_init(params):
return StatsForecast(
freq='D',
models=[
AutoARIMA(),
]
)
arima_model = arima_model_init(None)
arima_model.fit(train)
StatsForecast(models=[AutoARIMA])
Plot and analyze residuals of the model
#get result to analyze residuals later
arima_result=arima_model.fitted_[0,0].model_
arima_result
{'coef': {'ar1': -0.2950615409923522,
'ar2': -0.7514466300195752,
'ma1': 0.21164529710605853,
'ma2': 0.8111743661957798,
'ma3': -0.09865802999200439,
'drift': 0.18062057096145087},
'sigma2': 3.341184844962976,
'var_coef': array([[4.97817197e-03, 5.48444802e-05, 0.00000000e+00, 0.00000000e+00,
0.00000000e+00, 0.00000000e+00],
[5.48444802e-05, 3.25549646e-04, 0.00000000e+00, 0.00000000e+00,
0.00000000e+00, 0.00000000e+00],
[0.00000000e+00, 0.00000000e+00, 1.71526587e-03, 0.00000000e+00,
0.00000000e+00, 0.00000000e+00],
[0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 1.71526587e-03,
0.00000000e+00, 0.00000000e+00],
[0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
1.71526587e-03, 0.00000000e+00],
[0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
0.00000000e+00, 1.71526587e-03]]),
'mask': array([ True, True, True, True, True, True]),
'loglik': -1175.9484200614384,
'aic': 2365.8968401228767,
'arma': (2, 3, 0, 0, 1, 1, 0),
'residuals': array([ 1.90113696e-02, -1.06078399e-01, -1.22416591e-01, 2.81102130e-01,
4.00879243e-01, -5.70754063e-01, -6.37218095e-01, -5.47684314e-01,
1.63864788e-01, 1.19152166e+00, 6.49721687e-01, -7.78642063e-01,
-2.23525236e-01, -8.88221279e-02, -2.50977963e-01, 8.12067089e-01,
2.76814950e-03, -1.00354548e-01, -1.28525852e+00, -5.77960545e-02,
9.57142797e-02, -1.04053711e-01, 9.32717014e-01, -2.09539749e-01,
-1.02647633e+00, -8.88933708e-01, -3.02103726e-01, -3.84813536e-01,
-5.08387440e-01, -3.57290156e-01, 3.52625984e-02, 2.63033922e+00,
-4.06124723e-01, -3.00041475e-01, 9.64528086e-02, -3.93979142e-02,
-6.78763263e-01, -7.18482876e-01, 5.67217568e-01, 3.99741680e-01,
-4.70937413e-01, -2.44751645e-01, -1.15373983e-01, -5.89120625e-01,
5.59276352e-01, -6.98662226e-01, -7.66105119e-01, -2.80192509e-01,
-1.30017256e-01, -1.93150189e-01, 8.32662150e-01, 1.09119541e-01,
1.09074507e+00, 1.12769289e-01, -1.73406778e-01, -1.00643870e-01,
-8.05833634e-02, 7.42472925e-02, 4.90677557e-02, 5.96363972e-01,
-5.42203021e-01, -3.74354875e-01, -2.05034831e-01, -2.31607118e-01,
-4.03771587e-01, 3.63106970e-01, 3.24200779e-01, 1.81042280e-01,
-1.56006998e-01, -6.71851954e-02, -8.34462367e-02, -7.53640486e-01,
-8.44536814e-01, 1.19983991e-02, -2.23403313e-02, -1.61478579e-01,
-3.16950138e-02, 5.03144816e-02, -6.46046615e-01, -9.63619328e-01,
-1.95840690e-01, 1.77945133e-01, -2.08006789e-01, -1.57126970e-01,
1.49841893e-02, 4.91541340e-01, 1.68625988e-02, -1.02331325e+00,
-1.40997755e-01, -1.55285342e-01, -3.38261824e-01, -2.43981420e-01,
-8.96585843e-01, 4.47955215e-01, 1.08928251e-01, 3.02671354e-01,
2.66385078e-01, 2.40405082e-01, 1.92756659e-01, -8.85331068e-01,
-6.34310537e-01, -3.98116853e-01, 8.88732952e-01, 9.03574325e-03,
-8.34622023e-02, 5.37687863e-02, -7.36032738e-01, -7.31997943e-03,
-4.19735872e-01, -4.41684963e-01, -2.72405558e-02, 4.15909887e-02,
2.50685910e-02, 5.89526963e-02, 8.05350738e-01, 1.37977301e+00,
-5.49918516e-01, -3.25153692e-01, -6.50200838e-02, -2.05726554e-01,
-8.20785551e-01, -3.63357519e-01, 7.39721841e+00, 1.30932937e+00,
-5.03555802e-01, 5.02482347e-01, 6.64866198e-01, -3.64429618e-01,
-2.73280187e+00, 2.03589842e+00, -1.99360212e-01, -9.89778884e-01,
-1.91872149e-01, 3.60724930e-01, -9.54785616e-01, -1.84755914e+00,
1.13100327e+00, 4.72297755e-01, -4.76524336e-01, -3.99494880e-02,
5.56294206e-01, 1.27868812e+00, 1.49670897e+00, -2.64890598e-01,
1.43354389e-02, 3.33486099e-02, -2.58795956e-02, 1.79127861e-01,
1.85659201e-01, -1.02586326e+00, -3.33796531e-01, -8.33360729e-01,
-8.15067605e-01, -8.43749429e-01, -6.95406647e-01, 1.08360136e+00,
-8.99295670e-01, -6.86566304e-01, 1.40855557e+00, 5.46157623e-02,
-4.54852557e-01, -9.95800089e-02, 2.42521669e-02, -3.64209086e-01,
-5.89008781e-01, 3.53489728e-01, -1.57737344e-01, -5.18015062e-01,
-3.12062290e-01, 2.06160168e-01, 1.26529262e+00, 1.85233884e+00,
-5.33057112e-01, 1.13502489e-01, 2.69903976e-01, 1.01192964e-01,
7.77152608e-01, -4.64100143e-01, -1.76804293e+00, -1.52568519e+00,
-6.86173525e-02, -8.12911371e-02, -2.54243108e-01, 8.92060122e-01,
-1.90525252e-01, 9.97438475e-02, 6.65323820e-01, -2.60349005e-02,
-2.66542494e-01, -2.31245813e-01, -3.35497351e-01, -2.44578820e+00,
-1.82434099e-01, 1.79651028e-01, -1.98293795e-02, -8.79088291e-02,
1.79392433e-01, -8.41303328e-01, -2.49278557e+00, -5.11157637e-01,
-1.45473755e+00, 4.94402139e-01, 7.78428679e-01, 8.93191581e-01,
3.41391195e-02, -6.92183387e-01, -3.09346925e-01, -1.75606837e-01,
9.48542101e-01, 1.07891476e+00, 1.11949706e+00, -1.39560730e+00,
1.11654946e+00, 1.48435482e-01, -1.50856122e+00, -9.34720274e-02,
3.63826532e-01, 4.17721938e-02, 1.55226119e+00, 5.76766362e-01,
-4.07563734e-02, -1.12639792e+00, -2.12148418e-01, -4.42936035e-02,
-2.85491853e-01, -2.80404845e-01, -1.56201742e+00, -1.08914586e+00,
-9.33144481e-01, -3.83072912e-01, -3.12390108e-01, -3.46119723e-01,
-5.33381443e-01, 4.40130536e-01, -2.10324415e-02, -1.96213268e+00,
-2.99995419e-01, 3.93803077e-02, -2.82502333e-01, -7.97020421e-01,
-1.37561234e+00, -1.39846723e+00, 2.59722415e-01, 4.13137596e-02,
1.83875940e-03, 2.93355260e-02, -4.96010695e-01, 3.35594548e-01,
4.85623231e-01, 2.32576979e-01, 2.28902226e-01, 3.17212066e-01,
2.87308260e-01, -1.46269330e+00, 1.67673990e-01, 6.74220063e-01,
8.44993919e-01, -4.24032601e-01, -2.96862953e-01, -2.17838032e-01,
2.33413633e-01, 7.77812844e-01, 7.40032161e-02, -1.66858901e+00,
-1.37826664e-01, 1.80040495e-01, -3.69372549e-02, -2.43183863e+00,
-2.03627572e+00, -1.87422404e-01, -9.89213094e-01, 3.98893098e-02,
5.60368122e-01, 4.82147474e-01, 3.23365985e-01, -2.05734638e+00,
-1.65308547e+00, 3.72305668e-03, -5.71957259e-02, -1.07005917e-01,
1.52729316e-01, -4.66181135e-01, 1.18365846e+00, 1.13839396e+00,
1.38788962e+00, 1.21653711e-01, 4.21495719e-02, 1.72673233e-01,
3.79492260e-02, 3.33972220e-01, 2.64964013e-01, 1.25200990e+00,
-2.61087901e-02, -1.98726232e-01, 3.34985336e-03, 9.37507572e-01,
-9.74007289e-01, 2.30243759e-01, -1.21941742e-01, 1.34189838e-01,
6.90366058e-02, 2.61623759e-01, -5.17683004e-01, -1.59336297e+00,
-7.67694349e-01, -5.37462721e-01, -1.25116028e-01, -1.31748474e-01,
3.14210016e-02, -5.30718334e-01, 2.09756017e-02, -1.48690648e+00,
-3.29993073e-01, -5.25862722e-01, -7.21430722e-01, -6.81795423e-01,
9.48798253e-01, -1.13026076e+00, 6.04890536e-01, 9.47940473e-01,
-3.91789139e-01, -6.91065809e-01, -4.04854600e-01, 9.61827289e-01,
1.98379947e-01, -8.43475505e-02, 5.47063195e-01, 3.48909316e-01,
3.85783328e-02, 1.91277673e-01, -4.67857356e-01, -1.74629483e+00,
4.66514097e-01, -1.25507101e-01, -1.86664409e-01, -1.62953851e-01,
3.51374659e-02, -3.20546864e-02, -1.41181145e-01, -6.97100386e-02,
-1.08266605e-01, -5.57102545e-01, -6.10748806e-01, -4.83710411e-01,
-5.11362288e-01, -9.01352822e-01, 1.70320499e-01, 1.03965616e+00,
8.71811366e-01, 8.09883616e-01, 9.99070427e-01, 8.48704895e-01,
9.77467029e-01, 3.42867678e-01, -2.21227923e-01, 2.43040009e-01,
2.55966264e-01, 2.25441825e-01, 2.67220492e-01, -4.89835846e-01,
8.06038905e-01, 2.32757327e+00, -1.20594931e-02, -3.02757057e-01,
4.70918969e-02, 1.24697530e-01, 1.13508020e+00, 1.78413100e-01,
-7.36317360e-01, 2.67316018e-01, 3.37539706e-01, 2.55171082e-01,
1.49990183e-01, -1.40559213e+00, 1.22511141e+00, 3.13060660e+00,
9.57800900e-01, 7.10573876e-01, 1.15867192e+00, -1.06798643e+00,
1.31045842e+00, -3.45495867e-01, 2.24951713e+00, 1.66702821e-02,
-3.30733617e-01, 6.31738612e-03, -1.20167674e-01, 1.34849713e+00,
-1.31676363e+00, -3.60150196e-01, -8.07744402e-01, -1.11140708e+00,
-1.10179464e+00, -9.01664448e-01, -2.20327719e+00, 1.05843932e+01,
1.16446232e+00, -9.44117750e-01, 2.82963279e-01, 6.29244565e-01,
-1.08144927e+00, -1.73127878e+00, 1.68733660e+00, 3.41395937e+00,
3.14589496e-01, 6.86729460e-01, 1.58791094e+00, 5.46865326e-01,
2.00829541e+00, 4.14420638e+00, -4.70272006e+00, -1.70614675e+00,
-3.36798916e-01, -5.31886592e-01, 5.38392562e+00, -7.37917577e-01,
-3.29218719e+00, -2.98393171e-01, 2.35591473e-01, -3.24670728e-01,
-9.71617268e-02, 1.08850594e+00, 8.52152505e-01, 6.10691650e-01,
2.77810859e+00, 5.11549969e-01, -2.31670124e-01, 5.08261292e-02,
-2.36002933e+00, -2.72987782e+00, -4.19532204e-01, 3.41076290e-02,
-2.79677604e-01, -3.15553099e-01, -8.67046971e-03, -9.81726886e-01,
-9.54658321e-01, -3.26317492e+00, 1.82365147e+00, -1.78578097e-01,
-9.10244978e-01, -4.53889971e-01, -1.66750197e+00, 1.21155689e+00,
3.40471397e+00, -2.28833428e+00, -1.29691569e+00, -6.72762706e-01,
-9.43377190e-01, 8.90078261e-01, -3.36425961e+00, 2.46926135e-01,
-8.39704069e+00, -5.05222245e-02, 1.53662736e+00, 7.49743658e-01,
2.24861323e+00, -2.35970164e+00, 2.77893257e+00, 5.13499767e+00,
-1.41780179e-01, -3.73049550e-01, 3.56852347e-01, -1.60229135e+00,
-4.09477432e+00, 2.53436251e+00, 3.52695463e+00, 4.93131163e-01,
5.68448234e-01, 1.73712410e+00, -1.56329364e+00, -1.16684740e+00,
-1.51881195e+00, 1.22951312e+00, -2.14695518e-01, -4.22468242e-01,
4.03383168e-01, 9.93986064e-01, 2.75972863e+00, -2.99787574e-01,
-1.96345728e+00, 5.84287891e-01, 6.33839381e-01, 4.15947386e-01,
4.64557157e-01, -4.71663328e-01, 8.55611930e+00, 3.14324797e+00,
1.29619080e+00, 2.05268816e+00, 2.28104528e+00, 1.43683628e+00,
4.26156246e-01, -3.91690575e+00, -1.40016480e+00, 1.55429700e+00,
1.65467723e+00, 1.63177780e+00, 1.45701320e+00, 5.97050440e+00,
-1.30569732e+00, -8.00435195e-01, 5.57347076e-01, 3.18954989e-01,
-4.25897153e-01, -9.55919026e-01, 4.53745582e+00, 4.18335891e+00,
2.04673605e+00, -2.40949985e-01, -1.06936570e-02, -6.11238041e-01,
4.08672106e+00, -1.96732703e+00, -2.88865296e+00, -4.15946292e+00,
-3.25443851e+00, -3.39243129e+00, -3.51386932e+00, 7.79972326e+00,
9.11396874e-01, -3.55519317e+00, -5.56325123e-01, 9.50588401e-01,
-4.99875482e-01, -6.25948879e-01, -1.01068446e+00, 5.60748707e+00,
-1.51659431e+00, -2.09687683e+00, 1.34706032e+00, 9.78119846e-01,
-2.86775795e-01, 3.13331386e+00, 4.26070795e+00, -7.72293763e+00,
1.58611519e-01, 1.00466224e+00, -5.35159010e-01, -1.53320412e+00,
-1.86610600e+00, -7.99170817e+00, 1.81722048e+00, -2.94115440e+00,
1.35729899e+00, 2.00588171e+00, 1.66208381e+00, -1.45718971e+00,
-8.19588237e+00, -2.56055387e+00, 7.18010557e-01, -1.06415987e+00,
-1.14079702e+00, -2.44681295e-01, -7.87466598e+00, 1.21238999e+01,
-6.24773492e+00, -3.91611782e+00, -1.94117983e+00, -1.84201648e+00,
-3.35522172e+00, 2.68944578e+00, -4.32732787e+00, 5.43440460e+00,
-2.58005118e-01, 9.97500003e-01, 1.71843527e+00, 1.43360439e+00,
6.61628229e+00, 2.22899339e+00, 4.71484068e+00, 1.95780477e+00,
1.62747819e+00, 1.75009219e+00, 1.83030241e+00, -2.84539107e+00,
6.25584601e-01, -4.27797524e+00, 4.66627599e+00, -5.78598354e-01,
-1.58804875e+00, -9.86616192e-01, 1.92748475e+00, -3.03825945e+00]),
'code': 2,
'n_cond': 0,
'nobs': 583,
'model': {'phi': array([-0.29506154, -0.75144663]),
'theta': array([ 0.2116453 , 0.81117437, -0.09865803]),
'delta': array([1.]),
'Z': array([1., 0., 0., 0., 1.]),
'a': array([-2.93062057, -0.21407564, -2.65472003, 0.29974869, 23.01820713]),
'P': array([[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
0.00000000e+00, 8.44015805e-22],
[ 0.00000000e+00, 3.53883589e-16, 5.55111512e-17,
-1.04083409e-17, 1.28858611e-22],
[ 0.00000000e+00, 5.55111512e-17, 3.33066907e-16,
-4.16333634e-17, 6.58571090e-22],
[ 0.00000000e+00, -1.04083409e-17, -4.16333634e-17,
3.46944695e-18, -7.14124125e-23],
[ 8.44015805e-22, 1.28858611e-22, 6.58571090e-22,
-7.14124125e-23, -8.44015805e-22]]),
'T': array([[-0.29506154, 1. , 0. , 0. , 0. ],
[-0.75144663, 0. , 1. , 0. , 0. ],
[ 0. , 0. , 0. , 1. , 0. ],
[ 0. , 0. , 0. , 0. , 0. ],
[ 1. , 0. , 0. , 0. , 1. ]]),
'V': array([[ 1. , 0.2116453 , 0.81117437, -0.09865803, 0. ],
[ 0.2116453 , 0.04479373, 0.17168124, -0.02088051, 0. ],
[ 0.81117437, 0.17168124, 0.65800385, -0.08002886, 0. ],
[-0.09865803, -0.02088051, -0.08002886, 0.00973341, -0. ],
[ 0. , 0. , 0. , -0. , 0. ]]),
'h': 0.0,
'Pn': array([[ 1.00000000e+00, 2.11645297e-01, 8.11174366e-01,
-9.86580300e-02, 1.20177994e-22],
[ 2.11645297e-01, 4.47937318e-02, 1.71681240e-01,
-2.08805081e-02, -2.43382581e-23],
[ 8.11174366e-01, 1.71681240e-01, 6.58003852e-01,
-8.00288649e-02, 7.14124125e-23],
[-9.86580300e-02, -2.08805081e-02, -8.00288649e-02,
9.73340688e-03, 0.00000000e+00],
[ 1.20177994e-22, -2.43382581e-23, 7.14124125e-23,
0.00000000e+00, -8.44015805e-22]])},
'xreg': array([[ 1.],
[ 2.],
[ 3.],
[ 4.],
[ 5.],
[ 6.],
[ 7.],
[ 8.],
[ 9.],
[ 10.],
[ 11.],
[ 12.],
[ 13.],
[ 14.],
[ 15.],
[ 16.],
[ 17.],
[ 18.],
[ 19.],
[ 20.],
[ 21.],
[ 22.],
[ 23.],
[ 24.],
[ 25.],
[ 26.],
[ 27.],
[ 28.],
[ 29.],
[ 30.],
[ 31.],
[ 32.],
[ 33.],
[ 34.],
[ 35.],
[ 36.],
[ 37.],
[ 38.],
[ 39.],
[ 40.],
[ 41.],
[ 42.],
[ 43.],
[ 44.],
[ 45.],
[ 46.],
[ 47.],
[ 48.],
[ 49.],
[ 50.],
[ 51.],
[ 52.],
[ 53.],
[ 54.],
[ 55.],
[ 56.],
[ 57.],
[ 58.],
[ 59.],
[ 60.],
[ 61.],
[ 62.],
[ 63.],
[ 64.],
[ 65.],
[ 66.],
[ 67.],
[ 68.],
[ 69.],
[ 70.],
[ 71.],
[ 72.],
[ 73.],
[ 74.],
[ 75.],
[ 76.],
[ 77.],
[ 78.],
[ 79.],
[ 80.],
[ 81.],
[ 82.],
[ 83.],
[ 84.],
[ 85.],
[ 86.],
[ 87.],
[ 88.],
[ 89.],
[ 90.],
[ 91.],
[ 92.],
[ 93.],
[ 94.],
[ 95.],
[ 96.],
[ 97.],
[ 98.],
[ 99.],
[100.],
[101.],
[102.],
[103.],
[104.],
[105.],
[106.],
[107.],
[108.],
[109.],
[110.],
[111.],
[112.],
[113.],
[114.],
[115.],
[116.],
[117.],
[118.],
[119.],
[120.],
[121.],
[122.],
[123.],
[124.],
[125.],
[126.],
[127.],
[128.],
[129.],
[130.],
[131.],
[132.],
[133.],
[134.],
[135.],
[136.],
[137.],
[138.],
[139.],
[140.],
[141.],
[142.],
[143.],
[144.],
[145.],
[146.],
[147.],
[148.],
[149.],
[150.],
[151.],
[152.],
[153.],
[154.],
[155.],
[156.],
[157.],
[158.],
[159.],
[160.],
[161.],
[162.],
[163.],
[164.],
[165.],
[166.],
[167.],
[168.],
[169.],
[170.],
[171.],
[172.],
[173.],
[174.],
[175.],
[176.],
[177.],
[178.],
[179.],
[180.],
[181.],
[182.],
[183.],
[184.],
[185.],
[186.],
[187.],
[188.],
[189.],
[190.],
[191.],
[192.],
[193.],
[194.],
[195.],
[196.],
[197.],
[198.],
[199.],
[200.],
[201.],
[202.],
[203.],
[204.],
[205.],
[206.],
[207.],
[208.],
[209.],
[210.],
[211.],
[212.],
[213.],
[214.],
[215.],
[216.],
[217.],
[218.],
[219.],
[220.],
[221.],
[222.],
[223.],
[224.],
[225.],
[226.],
[227.],
[228.],
[229.],
[230.],
[231.],
[232.],
[233.],
[234.],
[235.],
[236.],
[237.],
[238.],
[239.],
[240.],
[241.],
[242.],
[243.],
[244.],
[245.],
[246.],
[247.],
[248.],
[249.],
[250.],
[251.],
[252.],
[253.],
[254.],
[255.],
[256.],
[257.],
[258.],
[259.],
[260.],
[261.],
[262.],
[263.],
[264.],
[265.],
[266.],
[267.],
[268.],
[269.],
[270.],
[271.],
[272.],
[273.],
[274.],
[275.],
[276.],
[277.],
[278.],
[279.],
[280.],
[281.],
[282.],
[283.],
[284.],
[285.],
[286.],
[287.],
[288.],
[289.],
[290.],
[291.],
[292.],
[293.],
[294.],
[295.],
[296.],
[297.],
[298.],
[299.],
[300.],
[301.],
[302.],
[303.],
[304.],
[305.],
[306.],
[307.],
[308.],
[309.],
[310.],
[311.],
[312.],
[313.],
[314.],
[315.],
[316.],
[317.],
[318.],
[319.],
[320.],
[321.],
[322.],
[323.],
[324.],
[325.],
[326.],
[327.],
[328.],
[329.],
[330.],
[331.],
[332.],
[333.],
[334.],
[335.],
[336.],
[337.],
[338.],
[339.],
[340.],
[341.],
[342.],
[343.],
[344.],
[345.],
[346.],
[347.],
[348.],
[349.],
[350.],
[351.],
[352.],
[353.],
[354.],
[355.],
[356.],
[357.],
[358.],
[359.],
[360.],
[361.],
[362.],
[363.],
[364.],
[365.],
[366.],
[367.],
[368.],
[369.],
[370.],
[371.],
[372.],
[373.],
[374.],
[375.],
[376.],
[377.],
[378.],
[379.],
[380.],
[381.],
[382.],
[383.],
[384.],
[385.],
[386.],
[387.],
[388.],
[389.],
[390.],
[391.],
[392.],
[393.],
[394.],
[395.],
[396.],
[397.],
[398.],
[399.],
[400.],
[401.],
[402.],
[403.],
[404.],
[405.],
[406.],
[407.],
[408.],
[409.],
[410.],
[411.],
[412.],
[413.],
[414.],
[415.],
[416.],
[417.],
[418.],
[419.],
[420.],
[421.],
[422.],
[423.],
[424.],
[425.],
[426.],
[427.],
[428.],
[429.],
[430.],
[431.],
[432.],
[433.],
[434.],
[435.],
[436.],
[437.],
[438.],
[439.],
[440.],
[441.],
[442.],
[443.],
[444.],
[445.],
[446.],
[447.],
[448.],
[449.],
[450.],
[451.],
[452.],
[453.],
[454.],
[455.],
[456.],
[457.],
[458.],
[459.],
[460.],
[461.],
[462.],
[463.],
[464.],
[465.],
[466.],
[467.],
[468.],
[469.],
[470.],
[471.],
[472.],
[473.],
[474.],
[475.],
[476.],
[477.],
[478.],
[479.],
[480.],
[481.],
[482.],
[483.],
[484.],
[485.],
[486.],
[487.],
[488.],
[489.],
[490.],
[491.],
[492.],
[493.],
[494.],
[495.],
[496.],
[497.],
[498.],
[499.],
[500.],
[501.],
[502.],
[503.],
[504.],
[505.],
[506.],
[507.],
[508.],
[509.],
[510.],
[511.],
[512.],
[513.],
[514.],
[515.],
[516.],
[517.],
[518.],
[519.],
[520.],
[521.],
[522.],
[523.],
[524.],
[525.],
[526.],
[527.],
[528.],
[529.],
[530.],
[531.],
[532.],
[533.],
[534.],
[535.],
[536.],
[537.],
[538.],
[539.],
[540.],
[541.],
[542.],
[543.],
[544.],
[545.],
[546.],
[547.],
[548.],
[549.],
[550.],
[551.],
[552.],
[553.],
[554.],
[555.],
[556.],
[557.],
[558.],
[559.],
[560.],
[561.],
[562.],
[563.],
[564.],
[565.],
[566.],
[567.],
[568.],
[569.],
[570.],
[571.],
[572.],
[573.],
[574.],
[575.],
[576.],
[577.],
[578.],
[579.],
[580.],
[581.],
[582.],
[583.],
[584.]]),
'bic': 2396.47415042733,
'aicc': 2366.0916227315724,
'ic': None,
'x': array([ 19.192 , 19.265 , 19.332 , 19.799 ,
20.356 , 19.95833333, 19.56066667, 19.163 ,
19.539 , 20.947 , 21.708 , 21.099 ,
21.09666667, 21.09433333, 21.092 , 22.174 ,
22.206 , 22.336 , 21.258 , 21.43666667,
21.61533333, 21.794 , 22.971 , 22.753 ,
21.998 , 21.386 , 21.2015 , 21.017 ,
20.8325 , 20.648 , 20.796 , 23.659 ,
23.287 , 23.359 , 23.431 , 23.503 ,
23.218 , 22.714 , 23.315 , 23.89 ,
23.783 , 23.676 , 23.569 , 23.285 ,
24.184 , 23.455 , 22.962 , 22.96066667,
22.95933333, 22.958 , 24.043 , 24.235 ,
25.541 , 25.731 , 25.78766667, 25.84433333,
25.901 , 26.204 , 26.451 , 27.195 ,
26.776 , 26.7 , 26.624 , 26.548 ,
26.415 , 26.991 , 27.387 , 27.791 ,
27.85333333, 27.91566667, 27.978 , 27.472 ,
26.879 , 27.034 , 27.173 , 27.312 ,
27.451 , 27.59 , 27.169 , 26.502 ,
26.456 , 26.759 , 26.83966667, 26.92033333,
27.001 , 27.674 , 27.933 , 27.098 ,
27.127 , 27.09866667, 27.07033333, 27.042 ,
26.234 , 26.957 , 27.221 , 27.747 ,
28.13766667, 28.52833333, 28.919 , 28.204 ,
27.802 , 27.558 , 28.679 , 28.838 ,
28.997 , 29.156 , 28.566 , 28.879 ,
28.576 , 28.336 , 28.54366667, 28.75133333,
28.959 , 29.212 , 30.185 , 31.673 ,
31.262 , 31.233 , 31.204 , 31.175 ,
30.69 , 30.527 , 37.984 , 38.937 ,
39.23175 , 39.5265 , 39.82125 , 40.116 ,
37.857 , 39.768 , 39.322 , 39.27633333,
39.23066667, 39.185 , 38.666 , 37.485 ,
38.523 , 38.781 , 39.01766667, 39.25433333,
39.491 , 41.024 , 42.986 , 42.659 ,
42.697 , 42.975 , 43.253 , 43.531 ,
43.809 , 43.049 , 43.016 , 42.212 ,
41.68266667, 41.15333333, 40.624 , 41.88 ,
41.126 , 40.845 , 42.291 , 42.32966667,
42.36833333, 42.407 , 42.365 , 42.323 ,
42.1 , 42.498 , 42.393 , 42.288 ,
42.183 , 42.398 , 43.89 , 45.976 ,
45.474 , 45.80266667, 46.13133333, 46.46 ,
47.492 , 47.066 , 45.54 , 44.327 ,
44.42133333, 44.51566667, 44.61 , 45.66 ,
45.449 , 45.9 , 46.739 , 46.73666667,
46.73433333, 46.732 , 46.506 , 44.266 ,
44.517 , 44.686 , 44.92866667, 45.17133333,
45.414 , 44.657 , 42.551 , 42.372 ,
40.875 , 41.83866667, 42.80233333, 43.766 ,
43.933 , 43.492 , 43.35 , 43.287 ,
44.51066667, 45.73433333, 46.958 , 45.67 ,
47.123 , 47.174 , 46.003 , 46.27733333,
46.55166667, 46.826 , 48.774 , 49.266 ,
49.363 , 48.514 , 48.52075 , 48.5275 ,
48.53425 , 48.541 , 47.055 , 46.239 ,
45.563 , 45.43533333, 45.30766667, 45.18 ,
44.861 , 45.498 , 45.593 , 43.899 ,
43.92133333, 43.94366667, 43.966 , 43.517 ,
42.225 , 41.005 , 41.632 , 41.831 ,
42.03 , 42.229 , 41.898 , 42.47 ,
43.071 , 43.49 , 43.92333333, 44.35666667,
44.79 , 43.539 , 44.012 , 44.677 ,
45.763 , 45.59766667, 45.43233333, 45.267 ,
45.798 , 46.815 , 46.935 , 45.46 ,
45.667 , 45.874 , 46.081 , 43.954 ,
42.197 , 42.096 , 41.375 , 41.91266667,
42.45033333, 42.988 , 43.671 , 41.782 ,
40.322 , 40.495 , 40.71633333, 40.93766667,
41.159 , 40.782 , 42.316 , 43.512 ,
45.011 , 45.26166667, 45.51233333, 45.763 ,
45.967 , 46.566 , 46.955 , 48.335 ,
48.426 , 48.517 , 48.608 , 49.662 ,
48.899 , 49.486 , 49.3 , 49.67466667,
50.04933333, 50.424 , 49.982 , 48.703 ,
48.2315 , 47.76 , 47.91866667, 48.07733333,
48.236 , 47.821 , 48.141 , 46.812 ,
46.758 , 46.33833333, 45.91866667, 45.499 ,
46.579 , 45.534 , 46.603 , 47.508 ,
47.21833333, 46.92866667, 46.639 , 47.666 ,
48.092 , 48.342 , 48.913 , 49.303 ,
49.693 , 50.083 , 49.614 , 48.135 ,
48.992 , 48.823 , 48.936 , 49.049 ,
49.162 , 49.275 , 49.423 , 49.535 ,
49.526 , 49.1915 , 48.857 , 48.5225 ,
48.188 , 47.566 , 47.983 , 49.092 ,
50.14 , 51.188 , 52.236 , 53.14 ,
54.343 , 54.818 , 54.704 , 55.12825 ,
55.5525 , 55.97675 , 56.401 , 56.051 ,
57.102 , 59.499 , 59.55433333, 59.60966667,
59.665 , 59.867 , 61.365 , 61.656 ,
61.024 , 61.50566667, 61.98733333, 62.469 ,
62.786 , 61.5 , 63.035 , 66.153 ,
67.202 , 68.251 , 69.3 , 68.231 ,
70.082 , 69.66 , 72.108 , 72.15566667,
72.20333333, 72.251 , 72.182 , 73.897 ,
72.683 , 72.589 , 71.8135 , 71.038 ,
70.2625 , 69.487 , 67.49 , 78.527 ,
78.847 , 78.934 , 79.021 , 79.108 ,
78.761 , 77.69 , 79.018 , 82.274 ,
83.26166667, 84.24933333, 85.237 , 85.982 ,
88.734 , 92.588 , 87.502 , 86.93833333,
86.37466667, 85.811 , 91.937 , 90.926 ,
87.962 , 87.841 , 88.04833333, 88.25566667,
88.463 , 89.397 , 90.371 , 91.435 ,
94.25 , 94.50033333, 94.75066667, 95.001 ,
92.521 , 90.269 , 90.25 , 90.28125 ,
90.3125 , 90.34375 , 90.375 , 89.5 ,
88.966 , 85.89 , 88.024 , 87.73 ,
87.436 , 87.142 , 85.335 , 87.039 ,
90.617 , 88.23 , 87.47633333, 86.72266667,
85.969 , 87.4 , 84.039 , 84.675 ,
76.221 , 77.31166667, 78.40233333, 79.493 ,
82.38 , 79.651 , 82.686 , 87.798 ,
87.81066667, 87.82333333, 87.836 , 86.377 ,
83.06 , 85.8375 , 88.78 , 89.89366667,
91.00733333, 92.121 , 90.542 , 90.396 ,
88.79 , 89.859 , 90.04866667, 90.23833333,
90.428 , 91.357 , 94.649 , 94.4 ,
92.483 , 93.25866667, 94.03433333, 94.81 ,
95.377 , 94.898 , 103.775 , 106.411 ,
108.28075 , 110.1505 , 112.02025 , 113.89 ,
114.681 , 110.526 , 109.502 , 111.33466667,
113.16733333, 115. , 116.443 , 122.449 ,
120.941 , 120.865 , 121.13 , 121.395 ,
121.66 , 120.91 , 125.26 , 129.32 ,
131.93 , 131.61666667, 131.30333333, 130.99 ,
135.66 , 133.29 , 130.92 , 127. ,
124.02333333, 121.04666667, 118.07 , 126.18 ,
126.44 , 123.95 , 123.52 , 123.74666667,
123.97333333, 124.2 , 122.69 , 128.27 ,
127.04 , 125.81 , 126.58666667, 127.36333333,
128.14 , 131.43 , 134.84 , 127.48 ,
129.13 , 128.89666667, 128.66333333, 128.43 ,
126.32 , 117.91 , 121.11 , 118. ,
119.88 , 121.76 , 123.64 , 122.43 ,
114.39 , 112.4 , 113.07 , 112.55666667,
112.04333333, 111.53 , 103.69 , 117.13 ,
109.38 , 107.31 , 105.08 , 102.85 ,
100.62 , 104. , 98.75 , 105.16 ,
104.7 , 106.16666667, 107.63333333, 109.1 ,
116.15 , 117.96 , 122.91 , 124.57 ,
126.37666667, 128.18333333, 129.99 , 127.27 ,
128.42 , 123.86 , 129.26 , 128.34 ,
127.42 , 126.5 , 128.32 , 125.57 ]),
'lambda': None}
arima_name = arima_string(arima_result)
arima_name
'ARIMA(2,1,3) with drift '
fitted_arima_predictions = pd.DataFrame(arima_result.get("residuals"), columns=["residuals"])
plot_residuals(fitted_arima_predictions['residuals'])
Out-of-sample forecasts
arima_predictions = arima_model.predict(len(test))
arima_predictions.set_index(test.index, inplace=True)
fig = px.line(title="Nvidia closing prices (daily)")
fig.add_scatter(x=train['ds'], y=train['y'], mode='lines', name='train', line=dict(color='blue'))
fig.add_scatter(x=test['ds'], y=test['y'], mode='lines', name='test', line=dict(color='green'))
fig.add_scatter(x=arima_predictions['ds'], y=arima_predictions['AutoARIMA'], mode='lines', name='prediction', line=dict(color='red'))
fig.update_layout(template='plotly_white', width=1000, height=500)
fig.update_xaxes(title_text="date")
fig.update_yaxes(title_text="closing price")
fig.show()
Calculate quality metric by using MAPE
arima_mape = my_mape(arima_predictions['AutoARIMA'], test['y'])
model_metrics_logger.info(
f'Model name: {arima_name}, MAPE score: {arima_mape}'
)
Model name: ARIMA(2,1,3) with drift , MAPE score: 6.181598482885323
Find best hyperparameters using grid serach and expanding window cross-validation
def prophet_model_init(params):
return fp.Prophet(**params, yearly_seasonality = False, weekly_seasonality = False)
#m.add_regressor('U', mode=best_params['seasonality_mode'])
def prophet_cv_score(model):
model.fit(train)
cv_results = cross_validation(model, initial='384 days', period='40 days', horizon = '40 days', parallel="processes")
df_p = performance_metrics(cv_results, rolling_window=1)
return df_p.loc[0, 'mape']
prophet_grid_search = GridSearch(
all_params={
'changepoint_prior_scale': [0.005, 0.05, 0.5],
'n_changepoints': [10, 25, 100],
'changepoint_range': [0.7 ,0.8, 0.9]
},
model_initializer=prophet_model_init,
calculate_score=prophet_cv_score
)
prophet_grid_search.search()
13:05:10 - cmdstanpy - INFO - Chain [1] start processing 13:05:10 - cmdstanpy - INFO - Chain [1] done processing 13:05:20 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 1 of 27
Params: {'changepoint_prior_scale': 0.005, 'n_changepoints': 10, 'changepoint_range': 0.7}
Score: 0.14512832582445834
13:05:20 - cmdstanpy - INFO - Chain [1] done processing 13:05:22 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 2 of 27
Params: {'changepoint_prior_scale': 0.005, 'n_changepoints': 10, 'changepoint_range': 0.8}
Score: 0.14864800814797133
13:05:22 - cmdstanpy - INFO - Chain [1] done processing 13:05:25 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 3 of 27
Params: {'changepoint_prior_scale': 0.005, 'n_changepoints': 10, 'changepoint_range': 0.9}
Score: 0.14906051058841607
13:05:25 - cmdstanpy - INFO - Chain [1] done processing
Iteration: 4 of 27
Params: {'changepoint_prior_scale': 0.005, 'n_changepoints': 25, 'changepoint_range': 0.7}
Score: 0.1408405729564439
13:05:27 - cmdstanpy - INFO - Chain [1] start processing 13:05:27 - cmdstanpy - INFO - Chain [1] done processing 13:05:30 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 5 of 27
Params: {'changepoint_prior_scale': 0.005, 'n_changepoints': 25, 'changepoint_range': 0.8}
Score: 0.1450305760772098
13:05:30 - cmdstanpy - INFO - Chain [1] done processing 13:05:32 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 6 of 27
Params: {'changepoint_prior_scale': 0.005, 'n_changepoints': 25, 'changepoint_range': 0.9}
Score: 0.14024703782315856
13:05:32 - cmdstanpy - INFO - Chain [1] done processing 13:05:42 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 7 of 27
Params: {'changepoint_prior_scale': 0.005, 'n_changepoints': 100, 'changepoint_range': 0.7}
Score: 0.14891730840287315
13:05:42 - cmdstanpy - INFO - Chain [1] done processing 13:05:50 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 8 of 27
Params: {'changepoint_prior_scale': 0.005, 'n_changepoints': 100, 'changepoint_range': 0.8}
Score: 0.14863480903591914
13:05:51 - cmdstanpy - INFO - Chain [1] done processing 13:05:59 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 9 of 27
Params: {'changepoint_prior_scale': 0.005, 'n_changepoints': 100, 'changepoint_range': 0.9}
Score: 0.14859381370245686
13:05:59 - cmdstanpy - INFO - Chain [1] done processing 13:06:02 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 10 of 27
Params: {'changepoint_prior_scale': 0.05, 'n_changepoints': 10, 'changepoint_range': 0.7}
Score: 0.10880574492405588
13:06:02 - cmdstanpy - INFO - Chain [1] done processing 13:06:04 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 11 of 27
Params: {'changepoint_prior_scale': 0.05, 'n_changepoints': 10, 'changepoint_range': 0.8}
Score: 0.13847769436730914
13:06:04 - cmdstanpy - INFO - Chain [1] done processing 13:06:07 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 12 of 27
Params: {'changepoint_prior_scale': 0.05, 'n_changepoints': 10, 'changepoint_range': 0.9}
Score: 0.16138958387805238
13:06:07 - cmdstanpy - INFO - Chain [1] done processing 13:06:09 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 13 of 27
Params: {'changepoint_prior_scale': 0.05, 'n_changepoints': 25, 'changepoint_range': 0.7}
Score: 0.10878797647724012
13:06:09 - cmdstanpy - INFO - Chain [1] done processing 13:06:12 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 14 of 27
Params: {'changepoint_prior_scale': 0.05, 'n_changepoints': 25, 'changepoint_range': 0.8}
Score: 0.13937283600331168
13:06:12 - cmdstanpy - INFO - Chain [1] done processing 13:06:14 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 15 of 27
Params: {'changepoint_prior_scale': 0.05, 'n_changepoints': 25, 'changepoint_range': 0.9}
Score: 0.17639949498608426
13:06:14 - cmdstanpy - INFO - Chain [1] done processing 13:06:17 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 16 of 27
Params: {'changepoint_prior_scale': 0.05, 'n_changepoints': 100, 'changepoint_range': 0.7}
Score: 0.10795193861612207
13:06:17 - cmdstanpy - INFO - Chain [1] done processing 13:06:20 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 17 of 27
Params: {'changepoint_prior_scale': 0.05, 'n_changepoints': 100, 'changepoint_range': 0.8}
Score: 0.13702474780042417
13:06:20 - cmdstanpy - INFO - Chain [1] done processing 13:06:22 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 18 of 27
Params: {'changepoint_prior_scale': 0.05, 'n_changepoints': 100, 'changepoint_range': 0.9}
Score: 0.17180189613331878
13:06:23 - cmdstanpy - INFO - Chain [1] done processing 13:06:25 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 19 of 27
Params: {'changepoint_prior_scale': 0.5, 'n_changepoints': 10, 'changepoint_range': 0.7}
Score: 0.10898509733602253
13:06:25 - cmdstanpy - INFO - Chain [1] done processing 13:06:25 - cmdstanpy - ERROR - Chain [1] error: error during processing Operation not permitted Optimization terminated abnormally. Falling back to Newton. 13:06:25 - cmdstanpy - INFO - Chain [1] start processing 13:06:26 - cmdstanpy - INFO - Chain [1] done processing 13:06:28 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 20 of 27
Params: {'changepoint_prior_scale': 0.5, 'n_changepoints': 10, 'changepoint_range': 0.8}
Score: 0.15311910614650384
13:06:28 - cmdstanpy - INFO - Chain [1] done processing 13:06:31 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 21 of 27
Params: {'changepoint_prior_scale': 0.5, 'n_changepoints': 10, 'changepoint_range': 0.9}
Score: 0.18386236484557691
13:06:31 - cmdstanpy - INFO - Chain [1] done processing 13:06:33 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 22 of 27
Params: {'changepoint_prior_scale': 0.5, 'n_changepoints': 25, 'changepoint_range': 0.7}
Score: 0.1092396524641713
13:06:33 - cmdstanpy - INFO - Chain [1] done processing 13:06:36 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 23 of 27
Params: {'changepoint_prior_scale': 0.5, 'n_changepoints': 25, 'changepoint_range': 0.8}
Score: 0.1582031207476118
13:06:36 - cmdstanpy - INFO - Chain [1] done processing 13:06:39 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 24 of 27
Params: {'changepoint_prior_scale': 0.5, 'n_changepoints': 25, 'changepoint_range': 0.9}
Score: 0.1762679137618768
13:06:39 - cmdstanpy - INFO - Chain [1] done processing 13:06:42 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 25 of 27
Params: {'changepoint_prior_scale': 0.5, 'n_changepoints': 100, 'changepoint_range': 0.7}
Score: 0.10922675801816446
13:06:42 - cmdstanpy - INFO - Chain [1] done processing 13:06:46 - cmdstanpy - INFO - Chain [1] start processing
Iteration: 26 of 27
Params: {'changepoint_prior_scale': 0.5, 'n_changepoints': 100, 'changepoint_range': 0.8}
Score: 0.15954751907154296
13:06:47 - cmdstanpy - INFO - Chain [1] done processing
Iteration: 27 of 27
Params: {'changepoint_prior_scale': 0.5, 'n_changepoints': 100, 'changepoint_range': 0.9}
Score: 0.17226648269446876
Best score: 0.10795193861612207
with params {'changepoint_prior_scale': 0.05, 'n_changepoints': 100, 'changepoint_range': 0.7}
prophet_grid_search.display_results()
| score | changepoint_prior_scale | n_changepoints | changepoint_range | |
|---|---|---|---|---|
| 15 | 0.107952 | 0.050 | 100 | 0.7 |
| 12 | 0.108788 | 0.050 | 25 | 0.7 |
| 9 | 0.108806 | 0.050 | 10 | 0.7 |
| 18 | 0.108985 | 0.500 | 10 | 0.7 |
| 24 | 0.109227 | 0.500 | 100 | 0.7 |
| 21 | 0.109240 | 0.500 | 25 | 0.7 |
| 16 | 0.137025 | 0.050 | 100 | 0.8 |
| 10 | 0.138478 | 0.050 | 10 | 0.8 |
| 13 | 0.139373 | 0.050 | 25 | 0.8 |
| 5 | 0.140247 | 0.005 | 25 | 0.9 |
| 3 | 0.140841 | 0.005 | 25 | 0.7 |
| 4 | 0.145031 | 0.005 | 25 | 0.8 |
| 0 | 0.145128 | 0.005 | 10 | 0.7 |
| 8 | 0.148594 | 0.005 | 100 | 0.9 |
| 7 | 0.148635 | 0.005 | 100 | 0.8 |
| 1 | 0.148648 | 0.005 | 10 | 0.8 |
| 6 | 0.148917 | 0.005 | 100 | 0.7 |
| 2 | 0.149061 | 0.005 | 10 | 0.9 |
| 19 | 0.153119 | 0.500 | 10 | 0.8 |
| 22 | 0.158203 | 0.500 | 25 | 0.8 |
| 25 | 0.159548 | 0.500 | 100 | 0.8 |
| 11 | 0.161390 | 0.050 | 10 | 0.9 |
| 17 | 0.171802 | 0.050 | 100 | 0.9 |
| 26 | 0.172266 | 0.500 | 100 | 0.9 |
| 23 | 0.176268 | 0.500 | 25 | 0.9 |
| 14 | 0.176399 | 0.050 | 25 | 0.9 |
| 20 | 0.183862 | 0.500 | 10 | 0.9 |
Let's fit the best model
prophet_model = prophet_model_init(prophet_grid_search.get_best_params())
prophet_model.fit(train)
future = prophet_model.make_future_dataframe(periods=len(test))
#future['U'] = regressors_per_city['U'] # Future regressor U
forecast_prophet = prophet_model.predict(future)
13:06:50 - cmdstanpy - INFO - Chain [1] start processing 13:06:51 - cmdstanpy - INFO - Chain [1] done processing
Plot and analyze residuals of the model
fitted_forecast_prophet = pd.DataFrame(train['y'] - forecast_prophet[:len(train)]['yhat'], columns=["residuals"])
plot_residuals(fitted_forecast_prophet['residuals'])
fig = px.line(title="Nvidia closing prices (daily)")
fig.add_scatter(x=train['ds'], y=train['y'], mode='lines', name='train', line=dict(color='blue'))
fig.add_scatter(x=test['ds'], y=test['y'], mode='lines', name='test', line=dict(color='green'))
fig.add_scatter(x=forecast_prophet['ds'], y=forecast_prophet['yhat'], mode='lines', name='prediction', line=dict(color='red'))
fig.update_layout(template='plotly_white', width=1000, height=500)
fig.update_xaxes(title_text="date")
fig.update_yaxes(title_text="closing price")
fig.show()
Calculate quality metric by using MAPE
prophet_mape = my_mape(forecast_prophet['yhat'], test['y'])
model_metrics_logger.info(
f'Model name: Prophet, MAPE score: {prophet_mape}, hyperparameters: {prophet_grid_search.get_best_params()}'
)
Model name: Prophet, MAPE score: 13.272497223406763, hyperparameters: {'changepoint_prior_scale': 0.05, 'n_changepoints': 100, 'changepoint_range': 0.7}
In this work, I downloaded Nvidia's closing stock price, prepared data to work with MLForecast, NeuralForecast, and StatsForecast, and Prophet modules. Then split the data into train and test. Performed autocorrelation and stationarity analysis, came up with the conclusion that required making first-order differencing to make the time series stationary, and only one previous lag correlated with current. Then I tried five models: Linear Regression, XGBoost, ARIMA, LSTM, and Prophet, and found the best hyperparameters using grid search and cross-validation on train data. And finally fit the models on the whole training data, make predictions, and calculate the MAPE score on test data. The best score shows the Linear Regression model, the worst score has a Prophet model.